-
- fields as $fieldSet): ?>
-
+
+ fields as $fieldSet): ?>
+
-
-
+
+
- hiddenFields) ?>
-
+ hiddenFields) ?>
+
diff --git a/component/admin/layouts/view/list.php b/component/admin/layouts/view/list.php
index 72185994969..4652392dd90 100644
--- a/component/admin/layouts/view/list.php
+++ b/component/admin/layouts/view/list.php
@@ -1,4 +1,5 @@
'search',
- 'searchFieldSelector' => '#filter_search',
- 'limitFieldSelector' => '#list_' . $viewName . '_limit',
- 'activeOrder' => $listOrder,
- 'activeDirection' => $listDirn,
- 'filterButton' => (count($data->filterForm->getGroup('filter')) > 1)
+ 'searchField' => 'search',
+ 'searchFieldSelector' => '#filter_search',
+ 'limitFieldSelector' => '#list_' . $viewName . '_limit',
+ 'activeOrder' => $listOrder,
+ 'activeDirection' => $listDirn,
+ 'filterButton' => (count($data->filterForm->getGroup('filter')) > 1)
);
$filterOptions = array_merge($filterOptions, $data->filterFormOptions);
-if ($data->hasOrdering)
-{
- $saveOrderUrl = 'index.php?option=com_redshop&task=' . $viewName . '.saveOrderAjax&tmpl=component';
- $orderingColumn = true === $data->isNested ? 'lft' : 'ordering';
- $allowOrder = ($listOrder == $orderingColumn && strtolower($listDirn) == 'asc' && $data->canEdit && empty($search));
+if ($data->hasOrdering) {
+ $saveOrderUrl = 'index.php?option=com_redshop&task=' . $viewName . '.saveOrderAjax&tmpl=component';
+ $orderingColumn = true === $data->isNested ? 'lft' : 'ordering';
+ $allowOrder = ($listOrder == $orderingColumn && strtolower(
+ $listDirn
+ ) == 'asc' && $data->canEdit && empty($search));
- if ($allowOrder)
- {
- JHtml::_('sortablelist.sortable', 'table-' . $viewName, 'adminForm', strtolower($listDirn), $saveOrderUrl, false, true);
- }
+ if ($allowOrder) {
+ JHtml::_(
+ 'sortablelist.sortable',
+ 'table-' . $viewName,
+ 'adminForm',
+ strtolower($listDirn),
+ $saveOrderUrl,
+ false,
+ true
+ );
+ }
}
?>
- redirect(JURI::base() . "index.php?option=com_redshop", $msg);
- }
-
- // Set some model state values
- $app->enqueueMessage($msg);
- $this->setState('name', $installer->get('name'));
- $this->setState('result', $result);
- $this->setState('message', $installer->message);
- $this->setState('extension.message', $installer->get('extension.message'));
-
- // Cleanup the install files
- if (!JFile::exists($package['packagefile']))
- {
- $config = JFactory::getConfig();
- $package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile'];
- }
-
- JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
- ?>
-
-
-
-
-
- get('tmp_path');
-
- // Unpack the downloaded package file
- $package = JInstallerHelper::unpack($tmp_dest . '/' . $p_file);
-
- ?>
-
- input->getString('install_directory');
- $p_dir = JPath::clean($p_dir);
-
- // Did you give us a valid directory?
- if (!is_dir($p_dir))
- {
- JError::raiseWarning('SOME_ERROR_CODE', JText::_('COM_REDSHOP_PLEASE_ENTER_A_PACKAGE_DIRECTORY'));
-
- return false;
- }
-
- // Detect the package type
- $type = JInstallerHelper::detectType($p_dir);
-
- // Did you give us a valid package?
- if (!$type)
- {
- JError::raiseWarning('SOME_ERROR_CODE', JText::_('COM_REDSHOP_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'));
-
- return false;
- }
-
- $package['packagefile'] = null;
- $package['extractdir'] = null;
- $package['dir'] = $p_dir;
- $package['type'] = $type;
-
- return $package;
- }
+ public $_data = null;
+
+ public $_total = null;
+
+ public $_pagination = null;
+
+ public $_table_prefix = null;
+
+ public $_table = null;
+
+ /** @var object JTable object */
+ public $_url = null;
+
+ public function getData()
+ {
+ $app = JFactory::getApplication();
+
+ $this->getzipfilenames();
+
+ $this->install();
+ session_unregister("filename");
+ session_unregister("zipno");
+ $msg = JText::_('COM_REDSHOP_REDSHOP_REMOTLY_UPDATED');
+ $app->redirect(JURI::base() . 'index.php?option=com_redshop', $msg);
+ }
+
+ public function getzipfilenames()
+ {
+ $user = JFactory::getUser();
+ $url = Redshop::getConfig()->get(
+ 'REMOTE_UPDATE_DOMAIN_URL'
+ ) . "index.php?option=com_remoteupdate&view=getcomponent&redusername=" .
+ $user->username . "&reddomain=" . JURI::base() . "";
+
+ $ch = curl_init();
+
+ // Set curl to return the data instead of printing it to the browser.
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+
+ // Set the URL
+ curl_setopt($ch, CURLOPT_URL, $url);
+
+ // Execute the fetch
+ $data = curl_exec($ch);
+
+ // Close the connection
+ curl_close($ch);
+ ob_clean();
+ $fp = fopen(JPATH_ROOT . '/tmp/com_jcomments_new.zip', 'w');
+ fwrite($fp, $data);
+ fclose($fp);
+
+ $filename = JURI::base() . '/tmp/com_jcomments_new.zip';
+ $_SESSION['filename'][0] = $filename;
+ }
+
+ public function install()
+ {
+ $app = JFactory::getApplication();
+ $fileType = "url";
+
+ switch ($fileType) {
+ case 'url':
+ $package = $this->_getPackageFromUrl();
+ break;
+
+ default:
+ $this->setState('message', 'No Install Type Found');
+
+ return false;
+ break;
+ }
+
+ // Was the package unpacked?
+ 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);
+ }
+
+ // Get an installer instance
+ $installer = JInstaller::getInstance();
+
+ // Install the package
+ if (!$installer->install($package['dir'])) {
+ ?>
+
+ redirect(JURI::base() . "index.php?option=com_redshop", $msg);
+ }
+
+ // Set some model state values
+ $app->enqueueMessage($msg);
+ $this->setState('name', $installer->get('name'));
+ $this->setState('result', $result);
+ $this->setState('message', $installer->message);
+ $this->setState('extension.message', $installer->get('extension.message'));
+
+ // Cleanup the install files
+ if (!JFile::exists($package['packagefile'])) {
+ $config = JFactory::getConfig();
+ $package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile'];
+ }
+
+ JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
+ ?>
+
+
+
+
+
+ get('tmp_path');
+
+ // Unpack the downloaded package file
+ $package = JInstallerHelper::unpack($tmp_dest . '/' . $p_file);
+
+ ?>
+
+ get(
+ 'REMOTE_UPDATE_DOMAIN_URL'
+ ) . "index.php?option=com_reviews&domainname=" . JUri::getInstance()->toString(array('host'));
+ $ch = curl_init();
+ curl_setopt(
+ $ch,
+ CURLOPT_USERAGENT,
+ "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1"
+ );
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+ curl_setopt($ch, CURLOPT_ENCODING, "");
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_AUTOREFERER, true);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+ $content = curl_exec($ch);
+ preg_match_all("#
(.*?) #is", $content, $out);
+ $content = trim($out[0][0]);
+ $response = curl_getinfo($ch);
+ print_r($response);
+ JFactory::getApplication()->close();
+ curl_close($ch);
+ $x = count(explode(",", $content));
+
+ return $x;
+ }
+
+ public function _getPackageFromFolder()
+ {
+ $p_dir = JFactory::getApplication()->input->getString('install_directory');
+ $p_dir = JPath::clean($p_dir);
+
+ // Did you give us a valid directory?
+ if (!is_dir($p_dir)) {
+ JError::raiseWarning('SOME_ERROR_CODE', JText::_('COM_REDSHOP_PLEASE_ENTER_A_PACKAGE_DIRECTORY'));
+
+ return false;
+ }
+
+ // Detect the package type
+ $type = JInstallerHelper::detectType($p_dir);
+
+ // Did you give us a valid package?
+ if (!$type) {
+ JError::raiseWarning('SOME_ERROR_CODE', JText::_('COM_REDSHOP_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'));
+
+ return false;
+ }
+
+ $package['packagefile'] = null;
+ $package['extractdir'] = null;
+ $package['dir'] = $p_dir;
+ $package['type'] = $type;
+
+ return $package;
+ }
}
diff --git a/component/admin/models/zipcode.php b/component/admin/models/zipcode.php
index 86969b4ab49..631d70de176 100644
--- a/component/admin/models/zipcode.php
+++ b/component/admin/models/zipcode.php
@@ -18,45 +18,44 @@
*/
class RedshopModelZipcode extends RedshopModelForm
{
- /**
- * Method to save a record.
- *
- * @param array $data data
- * @return boolean
- *
- * @since 2.1.3
- * @throws Exception
- */
- public function save($data)
- {
- /** @var RedshopTableZipcode $table */
- $table = $this->getTable('Zipcode');
-
- if ($data['zipcodeto'] && ($data['zipcode'] > $data['zipcodeto']))
- {
- return false;
- }
-
- if (!$data['zipcodeto'])
- {
- $data['zipcodeto'] = $data['zipcode'];
- }
-
- for ($i = $data['zipcode']; $i <= $data['zipcodeto']; $i++)
- {
- $data['zipcode'] = is_numeric($data['zipcode']) ? $i : $data['zipcode'];
-
- if (!$table->bind($data) || !$table->docheck())
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_ZIPCODE_ALREADY_EXISTS') . ": " . $data['zipcode']);
- /** @scrutinizer ignore-deprecated */ JError::raiseWarning('', /** @scrutinizer ignore-deprecated */ $this->getError());
-
- continue;
- }
-
- parent::save($data);
- }
-
- return true;
- }
+ /**
+ * Method to save a record.
+ *
+ * @param array $data data
+ *
+ * @return boolean
+ *
+ * @throws Exception
+ * @since 2.1.3
+ */
+ public function save($data)
+ {
+ /** @var RedshopTableZipcode $table */
+ $table = $this->getTable('Zipcode');
+
+ if ($data['zipcodeto'] && ($data['zipcode'] > $data['zipcodeto'])) {
+ return false;
+ }
+
+ if (!$data['zipcodeto']) {
+ $data['zipcodeto'] = $data['zipcode'];
+ }
+
+ for ($i = $data['zipcode']; $i <= $data['zipcodeto']; $i++) {
+ $data['zipcode'] = is_numeric($data['zipcode']) ? $i : $data['zipcode'];
+
+ if (!$table->bind($data) || !$table->docheck()) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_ZIPCODE_ALREADY_EXISTS') . ": " . $data['zipcode']);
+ /** @scrutinizer ignore-deprecated */
+ JError::raiseWarning('', /** @scrutinizer ignore-deprecated */ $this->getError());
+
+ continue;
+ }
+
+ parent::save($data);
+ }
+
+ return true;
+ }
}
diff --git a/component/admin/models/zipcodes.php b/component/admin/models/zipcodes.php
index 6a220bd86a9..37d8defd418 100644
--- a/component/admin/models/zipcodes.php
+++ b/component/admin/models/zipcodes.php
@@ -1,4 +1,5 @@
getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
- $this->setState('filter.search', $search);
-
- $countryId = $this->getUserStateFromRequest($this->context . '.filter.country_id', 'filter_country_id');
- $this->setState('filter.country_id', $countryId);
-
- // List state information.
- parent::populateState($ordering, $direction);
- }
-
- /**
- * Method to get a store id based on model configuration state.
- *
- * This is necessary because the model is used by the component and
- * different modules that might need different sets of data or different
- * ordering requirements.
- *
- * @param string $id A prefix for the store id.
- *
- * @return string A store id.
- *
- * @since 2.1.3
- */
- protected function getStoreId($id = '')
- {
- // Compile the store id.
- $id .= ':' . $this->getState('filter.search');
- $id .= ':' . $this->getState('filter.country_id');
-
- return parent::getStoreId($id);
- }
-
- /**
- * Method to build an SQL query to load the list data.
- *
- * @return string An SQL query
- */
- protected function getListQuery()
- {
- $db = JFactory::getDbo();
- $query = $db->getQuery(true);
- $query->select(
- $db->qn(
- [
- 'z.id',
- 'z.country_code',
- 'z.state_code',
- 'z.city_name',
- 'z.zipcode',
- 'z.zipcodeto',
- 'c.country_name',
- 's.state_name',
- ]
- )
- )
- ->from($db->qn('#__redshop_zipcode', 'z'))
- ->leftJoin($db->qn('#__redshop_country', 'c') . ' ON ' . $db->qn('z.country_code') . ' = ' . $db->qn('c.country_3_code'))
- ->leftJoin(
- $db->qn('#__redshop_state', 's')
- . ' ON ' . $db->qn('z.state_code') . ' = ' . $db->qn('s.state_2_code')
- . ' AND ' . $db->qn('c.id') . ' = ' . $db->qn('s.country_id')
- );
-
- $search = $this->getState('filter.search');
-
- if (!empty($search))
- {
- $query->where(
- '(' . $db->qn('z.zipcode') . ' LIKE ' . $db->q($search) .
- ' OR ' . $db->qn('z.city_name') . ' LIKE ' . $db->q('%' . $search . '%') .
- ' OR ' . $db->qn('c.country_name') . 'LIKE' . $db->q('%' . $search . '%')
- . ')'
- );
- }
-
- $countryId = $this->getState('filter.country_id');
-
- if (!empty($countryId))
- {
- $query->where($db->qn('s.country_id') . ' = ' . $db->q($countryId));
- }
-
- // Add the list ordering clause.
- $orderCol = $this->state->get('list.ordering', 'z.id');
- $orderDirn = $this->state->get('list.direction', 'asc');
- $query->order($db->escape($orderCol . ' ' . $orderDirn));
-
- return $query;
- }
+ /**
+ * Name of the filter form to load
+ *
+ * @var string
+ */
+ protected $filterFormName = 'filter_zipcodes';
+
+ /**
+ * Construct class
+ *
+ * @since 2.1.3
+ */
+ public function __construct($config = array())
+ {
+ if (empty($config['filter_fields'])) {
+ $config['filter_fields'] = array(
+ 'id',
+ 'z.id',
+ 'country_code',
+ 'z.country_code',
+ 'state_code',
+ 'z.state_code',
+ 'city_name',
+ 'z.city_name',
+ 'zipcode',
+ 'z.zipcode',
+ 'zipcodeto',
+ 'z.zipcodeto',
+ );
+ }
+
+ parent::__construct($config);
+ }
+
+ /**
+ * Method to auto-populate the model state.
+ *
+ * This method should only be called once per instantiation and is designed
+ * to be called on the first call to the getState() method unless the model
+ * configuration flag to ignore the request is set.
+ *
+ * Note. Calling getState in this method will result in recursion.
+ *
+ * @param string $ordering An optional ordering field.
+ * @param string $direction An optional direction (asc|desc).
+ *
+ * @return void
+ *
+ * @since 2.1.3
+ */
+ protected function populateState($ordering = 'z.id', $direction = 'asc')
+ {
+ $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
+ $this->setState('filter.search', $search);
+
+ $countryId = $this->getUserStateFromRequest($this->context . '.filter.country_id', 'filter_country_id');
+ $this->setState('filter.country_id', $countryId);
+
+ // List state information.
+ parent::populateState($ordering, $direction);
+ }
+
+ /**
+ * Method to get a store id based on model configuration state.
+ *
+ * This is necessary because the model is used by the component and
+ * different modules that might need different sets of data or different
+ * ordering requirements.
+ *
+ * @param string $id A prefix for the store id.
+ *
+ * @return string A store id.
+ *
+ * @since 2.1.3
+ */
+ protected function getStoreId($id = '')
+ {
+ // Compile the store id.
+ $id .= ':' . $this->getState('filter.search');
+ $id .= ':' . $this->getState('filter.country_id');
+
+ return parent::getStoreId($id);
+ }
+
+ /**
+ * Method to build an SQL query to load the list data.
+ *
+ * @return string An SQL query
+ */
+ protected function getListQuery()
+ {
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true);
+ $query->select(
+ $db->qn(
+ [
+ 'z.id',
+ 'z.country_code',
+ 'z.state_code',
+ 'z.city_name',
+ 'z.zipcode',
+ 'z.zipcodeto',
+ 'c.country_name',
+ 's.state_name',
+ ]
+ )
+ )
+ ->from($db->qn('#__redshop_zipcode', 'z'))
+ ->leftJoin(
+ $db->qn('#__redshop_country', 'c') . ' ON ' . $db->qn('z.country_code') . ' = ' . $db->qn(
+ 'c.country_3_code'
+ )
+ )
+ ->leftJoin(
+ $db->qn('#__redshop_state', 's')
+ . ' ON ' . $db->qn('z.state_code') . ' = ' . $db->qn('s.state_2_code')
+ . ' AND ' . $db->qn('c.id') . ' = ' . $db->qn('s.country_id')
+ );
+
+ $search = $this->getState('filter.search');
+
+ if (!empty($search)) {
+ $query->where(
+ '(' . $db->qn('z.zipcode') . ' LIKE ' . $db->q($search) .
+ ' OR ' . $db->qn('z.city_name') . ' LIKE ' . $db->q('%' . $search . '%') .
+ ' OR ' . $db->qn('c.country_name') . 'LIKE' . $db->q('%' . $search . '%')
+ . ')'
+ );
+ }
+
+ $countryId = $this->getState('filter.country_id');
+
+ if (!empty($countryId)) {
+ $query->where($db->qn('s.country_id') . ' = ' . $db->q($countryId));
+ }
+
+ // Add the list ordering clause.
+ $orderCol = $this->state->get('list.ordering', 'z.id');
+ $orderDirn = $this->state->get('list.direction', 'asc');
+ $query->order($db->escape($orderCol . ' ' . $orderDirn));
+
+ return $query;
+ }
}
\ No newline at end of file
diff --git a/component/admin/redshop.php b/component/admin/redshop.php
index 1d50e174f60..053e8c6e5f0 100644
--- a/component/admin/redshop.php
+++ b/component/admin/redshop.php
@@ -1,4 +1,5 @@
isExists() && $app->input->getCmd('view') != 'install')
-{
- $controller = 'redshop';
- \JFactory::getApplication()->input->set('view', 'redshop');
- \JFactory::getApplication()->input->set('layout', 'noconfig');
+if (!$config->isExists() && $app->input->getCmd('view') != 'install') {
+ $controller = 'redshop';
+ \JFactory::getApplication()->input->set('view', 'redshop');
+ \JFactory::getApplication()->input->set('layout', 'noconfig');
}
\Redshop\Shipping\Rate::removeShippingRate();
@@ -40,31 +40,28 @@
$user->usertype = $userType[0];
$user->gid = $user->groups[$user->usertype];
-if (!$user->authorise('core.manage', 'com_redshop') && !$json)
-{
- $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
+if (!$user->authorise('core.manage', 'com_redshop') && !$json) {
+ $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
- return false;
+ return false;
}
$isWizard = \JFactory::getApplication()->input->getInt('wizard', 0);
$step = \JFactory::getApplication()->input->get('step', '');
// Initialize wizard
-if ($isWizard || $step != '')
-{
- if ($user->gid != 8 && !$user->authorise('core.manage', 'com_redshop'))
- {
- throw new Exception('COM_REDSHOP_DONT_HAVE_PERMISSION');
- }
+if ($isWizard || $step != '') {
+ if ($user->gid != 8 && !$user->authorise('core.manage', 'com_redshop')) {
+ throw new Exception('COM_REDSHOP_DONT_HAVE_PERMISSION');
+ }
- \JFactory::getApplication()->input->set('view', 'wizard');
+ \JFactory::getApplication()->input->set('view', 'wizard');
- require_once JPATH_COMPONENT . '/helpers/wizard/wizard.php';
- $redSHOPWizard = new \redSHOPWizard;
- $redSHOPWizard->initialize();
+ require_once JPATH_COMPONENT . '/helpers/wizard/wizard.php';
+ $redSHOPWizard = new \redSHOPWizard;
+ $redSHOPWizard->initialize();
- return true;
+ return true;
}
$view = $app->input->get('view', 'redshop');
@@ -78,33 +75,26 @@
// Check for array format.
$filter = \JFilterInput::getInstance();
-if (is_array($task))
-{
- $command = $filter->clean(array_pop(array_keys($task)), 'cmd');
-}
-else
-{
- $command = $filter->clean($task, 'cmd');
+if (is_array($task)) {
+ $command = $filter->clean(array_pop(array_keys($task)), 'cmd');
+} else {
+ $command = $filter->clean($task, 'cmd');
}
// Check for a not controller.task command.
-if ($command != '' && strpos($command, '.') === false)
-{
- \JFactory::getApplication()->input->set('task', $view . '.' . $command);
- $task = $command;
-}
-elseif ($command != '' && strpos($command, '.') !== false)
-{
- $commands = explode('.', $command);
- $view = $commands[0];
- $task = $commands[1];
+if ($command != '' && strpos($command, '.') === false) {
+ \JFactory::getApplication()->input->set('task', $view . '.' . $command);
+ $task = $command;
+} elseif ($command != '' && strpos($command, '.') !== false) {
+ $commands = explode('.', $command);
+ $view = $commands[0];
+ $task = $commands[1];
}
// Set the controller page
-if (!file_exists(JPATH_COMPONENT . '/controllers/' . $view . '.php'))
-{
- $view = 'redshop';
- \JFactory::getApplication()->input->set('view', $view);
+if (!file_exists(JPATH_COMPONENT . '/controllers/' . $view . '.php')) {
+ $view = 'redshop';
+ \JFactory::getApplication()->input->set('view', $view);
}
\RedshopHelperConfig::script('SITE_URL', \JURI::root());
diff --git a/component/admin/sql/index.html b/component/admin/sql/index.html
index 94906bce29b..af1d3c9d43e 100644
--- a/component/admin/sql/index.html
+++ b/component/admin/sql/index.html
@@ -1 +1,3 @@
-
+
+
+
diff --git a/component/admin/sql/install/index.html b/component/admin/sql/install/index.html
index 94906bce29b..af1d3c9d43e 100644
--- a/component/admin/sql/install/index.html
+++ b/component/admin/sql/install/index.html
@@ -1 +1,3 @@
-
+
+
+
diff --git a/component/admin/sql/install/mysql/index.html b/component/admin/sql/install/mysql/index.html
index 94906bce29b..af1d3c9d43e 100644
--- a/component/admin/sql/install/mysql/index.html
+++ b/component/admin/sql/install/mysql/index.html
@@ -1 +1,3 @@
-
+
+
+
diff --git a/component/admin/sql/updates/index.html b/component/admin/sql/updates/index.html
index 94906bce29b..af1d3c9d43e 100644
--- a/component/admin/sql/updates/index.html
+++ b/component/admin/sql/updates/index.html
@@ -1 +1,3 @@
-
+
+
+
diff --git a/component/admin/sql/updates/mysql/index.html b/component/admin/sql/updates/mysql/index.html
index 94906bce29b..af1d3c9d43e 100644
--- a/component/admin/sql/updates/mysql/index.html
+++ b/component/admin/sql/updates/mysql/index.html
@@ -1 +1,3 @@
-
+
+
+
diff --git a/component/admin/tables/accessory_detail.php b/component/admin/tables/accessory_detail.php
index 68d0ee047ee..2e45c74b932 100644
--- a/component/admin/tables/accessory_detail.php
+++ b/component/admin/tables/accessory_detail.php
@@ -11,38 +11,37 @@
class Tableaccessory_detail extends JTable
{
- public $accessoryId = null;
+ public $accessoryId = null;
- public $product_id = null;
+ public $product_id = null;
- public $child_product_id = null;
+ public $child_product_id = null;
- public $accessory_price = null;
+ public $accessory_price = null;
- public $oprand = null;
+ public $oprand = null;
- public $ordering = null;
+ public $ordering = null;
- public $category_id = null;
+ public $category_id = null;
- public $setdefault_selected = null;
+ public $setdefault_selected = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_accessory', 'accessory_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_accessory', 'accessory_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/accountgroup_detail.php b/component/admin/tables/accountgroup_detail.php
index 2233719307d..710815ca4ec 100644
--- a/component/admin/tables/accountgroup_detail.php
+++ b/component/admin/tables/accountgroup_detail.php
@@ -11,43 +11,42 @@
class Tableaccountgroup_detail extends JTable
{
- public $accountgroup_id = null;
+ public $accountgroup_id = null;
- public $accountgroup_name = null;
+ public $accountgroup_name = null;
- public $economic_vat_account = null;
+ public $economic_vat_account = null;
- public $economic_nonvat_account = null;
+ public $economic_nonvat_account = null;
- public $economic_discount_vat_account = null;
+ public $economic_discount_vat_account = null;
- public $economic_discount_nonvat_account = null;
+ public $economic_discount_nonvat_account = null;
- public $economic_shipping_vat_account = null;
+ public $economic_shipping_vat_account = null;
- public $economic_shipping_nonvat_account = null;
+ public $economic_shipping_nonvat_account = null;
- public $economic_discount_product_number = null;
+ public $economic_discount_product_number = null;
- public $published = 1;
+ public $published = 1;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'economic_accountgroup', 'accountgroup_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'economic_accountgroup', 'accountgroup_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/alert_detail.php b/component/admin/tables/alert_detail.php
index aa8e6396c69..8ceeaa64d1a 100644
--- a/component/admin/tables/alert_detail.php
+++ b/component/admin/tables/alert_detail.php
@@ -11,18 +11,18 @@
class Tablealert_detail extends JTable
{
- public $id = 0;
+ public $id = 0;
- public $message = null;
+ public $message = null;
- public $sent_date = null;
+ public $sent_date = null;
- public $read = 0;
+ public $read = 0;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'alert', 'id', $db);
- }
+ parent::__construct($this->_table_prefix . 'alert', 'id', $db);
+ }
}
diff --git a/component/admin/tables/associations.php b/component/admin/tables/associations.php
index 8f6528afe21..11a536994e2 100644
--- a/component/admin/tables/associations.php
+++ b/component/admin/tables/associations.php
@@ -13,29 +13,29 @@
*/
class TableAssociations extends JTable
{
- /** @var int Primary key */
- public $id = null;
+ /** @var int Primary key */
+ public $id = null;
- /** @var string Whether or not a product is published */
- public $published = null;
+ /** @var string Whether or not a product is published */
+ public $published = null;
- /** @var string Whether or not a product is checked out */
- public $checked_out = null;
+ /** @var string Whether or not a product is checked out */
+ public $checked_out = null;
- /** @var string When a product is checked out */
- public $checked_out_time = null;
+ /** @var string When a product is checked out */
+ public $checked_out_time = null;
- /** @var integer The order of the product */
- public $ordering = 0;
+ /** @var integer The order of the product */
+ public $ordering = 0;
- /** @var integer The ID of the Redshop product */
- public $product_id = 0;
+ /** @var integer The ID of the Redshop product */
+ public $product_id = 0;
- /**
- * @param database A database connector object
- */
- public function __construct(&$db)
- {
- parent::__construct('#__redproductfinder_associations', 'id', $db);
- }
+ /**
+ * @param database A database connector object
+ */
+ public function __construct(&$db)
+ {
+ parent::__construct('#__redproductfinder_associations', 'id', $db);
+ }
}
diff --git a/component/admin/tables/attribute.php b/component/admin/tables/attribute.php
index 5f83c03e274..f639b445b99 100644
--- a/component/admin/tables/attribute.php
+++ b/component/admin/tables/attribute.php
@@ -20,106 +20,93 @@
*/
class RedshopTableAttribute extends JTable
{
- /**
- * Constructor
- *
- * @param JDatabaseDriver $db Database driver object.
- *
- * @since 11.1
- */
- public function __construct($db)
- {
- parent::__construct('#__redshop_product_attribute', 'attribute_id', $db);
- }
-
- /**
- * Method to set the publishing state for a row or list of rows in the database
- * table. The method respects checked out rows by other users and will attempt
- * to checkin rows that it can after adjustments are made.
- *
- * @param mixed $pks An optional array of primary key values to update. If not set the instance property value is used.
- * @param integer $state The publishing state. eg. [0 = unpublished, 1 = published, 2=archived, -2=trashed]
- * @param integer $userId The user id of the user performing the operation.
- *
- * @return boolean True on success.
- *
- * @since 1.0.4
- */
- public function publish($pks = null, $state = 1, $userId = 0)
- {
- $k = $this->_tbl_key;
-
- // Sanitize input.
- $pks = ArrayHelper::toInteger($pks);
- $userId = (int) $userId;
- $state = (int) $state;
-
- // If there are no primary keys set check to see if the instance key is set.
- if (empty($pks))
- {
- if ($this->$k)
- {
- $pks = array($this->$k);
- }
- // Nothing to set publishing state on, return false.
- else
- {
- $this->setError(JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED'));
-
- return false;
- }
- }
-
- // Build the WHERE clause for the primary keys.
- $where = $k . '=' . implode(' OR ' . $k . '=', $pks);
-
- // Determine if there is checkin support for the table.
- if (!property_exists($this, 'checked_out') || !property_exists($this, 'checked_out_time'))
- {
- $checkin = '';
- }
- else
- {
- $checkin = ' AND (checked_out = 0 OR checked_out = ' . (int) $userId . ')';
- }
-
- // Update the publishing state for rows with the given primary keys.
- $this->_db->setQuery(
- 'UPDATE ' . $this->_db->quoteName($this->_tbl)
- . ' SET ' . $this->_db->quoteName('attribute_published') . ' = ' . (int) $state
- . ' WHERE (' . $where . ')'
- . $checkin
- );
-
- try
- {
- $this->_db->execute();
- }
- catch (RuntimeException $e)
- {
- $this->setError($e->getMessage());
-
- return false;
- }
-
- // If checkin is supported and all rows were adjusted, check them in.
- if ($checkin && (count($pks) == $this->_db->getAffectedRows()))
- {
- // Checkin the rows.
- foreach ($pks as $pk)
- {
- $this->checkin($pk);
- }
- }
-
- // If the JTable instance value is in the list of primary keys that were set, set the instance.
- if (in_array($this->$k, $pks))
- {
- $this->state = $state;
- }
-
- $this->setError('');
-
- return true;
- }
+ /**
+ * Constructor
+ *
+ * @param JDatabaseDriver $db Database driver object.
+ *
+ * @since 11.1
+ */
+ public function __construct($db)
+ {
+ parent::__construct('#__redshop_product_attribute', 'attribute_id', $db);
+ }
+
+ /**
+ * Method to set the publishing state for a row or list of rows in the database
+ * table. The method respects checked out rows by other users and will attempt
+ * to checkin rows that it can after adjustments are made.
+ *
+ * @param mixed $pks An optional array of primary key values to update. If not set the instance property value is used.
+ * @param integer $state The publishing state. eg. [0 = unpublished, 1 = published, 2=archived, -2=trashed]
+ * @param integer $userId The user id of the user performing the operation.
+ *
+ * @return boolean True on success.
+ *
+ * @since 1.0.4
+ */
+ public function publish($pks = null, $state = 1, $userId = 0)
+ {
+ $k = $this->_tbl_key;
+
+ // Sanitize input.
+ $pks = ArrayHelper::toInteger($pks);
+ $userId = (int)$userId;
+ $state = (int)$state;
+
+ // If there are no primary keys set check to see if the instance key is set.
+ if (empty($pks)) {
+ if ($this->$k) {
+ $pks = array($this->$k);
+ } // Nothing to set publishing state on, return false.
+ else {
+ $this->setError(JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED'));
+
+ return false;
+ }
+ }
+
+ // Build the WHERE clause for the primary keys.
+ $where = $k . '=' . implode(' OR ' . $k . '=', $pks);
+
+ // Determine if there is checkin support for the table.
+ if (!property_exists($this, 'checked_out') || !property_exists($this, 'checked_out_time')) {
+ $checkin = '';
+ } else {
+ $checkin = ' AND (checked_out = 0 OR checked_out = ' . (int)$userId . ')';
+ }
+
+ // Update the publishing state for rows with the given primary keys.
+ $this->_db->setQuery(
+ 'UPDATE ' . $this->_db->quoteName($this->_tbl)
+ . ' SET ' . $this->_db->quoteName('attribute_published') . ' = ' . (int)$state
+ . ' WHERE (' . $where . ')'
+ . $checkin
+ );
+
+ try {
+ $this->_db->execute();
+ } catch (RuntimeException $e) {
+ $this->setError($e->getMessage());
+
+ return false;
+ }
+
+ // If checkin is supported and all rows were adjusted, check them in.
+ if ($checkin && (count($pks) == $this->_db->getAffectedRows())) {
+ // Checkin the rows.
+ foreach ($pks as $pk) {
+ $this->checkin($pk);
+ }
+ }
+
+ // If the JTable instance value is in the list of primary keys that were set, set the instance.
+ if (in_array($this->$k, $pks)) {
+ $this->state = $state;
+ }
+
+ $this->setError('');
+
+ return true;
+ }
}
diff --git a/component/admin/tables/attribute_property.php b/component/admin/tables/attribute_property.php
index 1716c744e4e..6d1a07caa09 100644
--- a/component/admin/tables/attribute_property.php
+++ b/component/admin/tables/attribute_property.php
@@ -11,50 +11,49 @@
class Tableattribute_property extends JTable
{
- public $propertyId = null;
+ public $propertyId = null;
- public $attributeId = null;
+ public $attributeId = null;
- public $property_name = null;
+ public $property_name = null;
- public $property_price = null;
+ public $property_price = null;
- public $oprand = null;
+ public $oprand = null;
- public $property_image = null;
+ public $property_image = null;
- public $property_main_image = null;
+ public $property_main_image = null;
- public $ordering = null;
+ public $ordering = null;
- public $property_number = null;
+ public $property_number = null;
- public $setdefault_selected = 0;
+ public $setdefault_selected = 0;
- public $setrequire_selected = 0;
+ public $setrequire_selected = 0;
- public $setmulti_selected = 0;
+ public $setmulti_selected = 0;
- public $setdisplay_type = null;
+ public $setdisplay_type = null;
- public $property_published = 1;
+ public $property_published = 1;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_attribute_property', 'property_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_attribute_property', 'property_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/attribute_set_detail.php b/component/admin/tables/attribute_set_detail.php
index 3bd4ee0a4d9..e6f092784be 100644
--- a/component/admin/tables/attribute_set_detail.php
+++ b/component/admin/tables/attribute_set_detail.php
@@ -11,28 +11,27 @@
class Tableattribute_set_detail extends JTable
{
- public $attribute_set_id = null;
+ public $attribute_set_id = null;
- public $attribute_set_name = 0;
+ public $attribute_set_name = 0;
- public $published = null;
+ public $published = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'attribute_set', 'attribute_set_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'attribute_set', 'attribute_set_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/attributeprices_detail.php b/component/admin/tables/attributeprices_detail.php
index 8de915b7bbf..87ccec2f3aa 100644
--- a/component/admin/tables/attributeprices_detail.php
+++ b/component/admin/tables/attributeprices_detail.php
@@ -61,9 +61,9 @@ public function __construct(&$db)
*/
public function check()
{
- $xid = \Redshop\Attribute\Helper::getAttributePriceStartId($this);
+ $xid = \Redshop\Attribute\Helper::getAttributePriceStartId($this);
$xidEnd = \Redshop\Attribute\Helper::getAttributePriceStartId($this);
-
+
if (($xid || $xidEnd)
&& (($xid != intval($this->price_id)
@@ -73,7 +73,8 @@ public function check()
) {
$this->_error = \Joomla\CMS\Language\Text::sprintf(
'WARNNAMETRYAGAIN',
- \Joomla\CMS\Language\Text::_('COM_REDSHOP_PRICE_ALREADY_EXISTS'));
+ \Joomla\CMS\Language\Text::_('COM_REDSHOP_PRICE_ALREADY_EXISTS')
+ );
return false;
}
diff --git a/component/admin/tables/barcode.php b/component/admin/tables/barcode.php
index c2f36309fcb..684493b8f3c 100644
--- a/component/admin/tables/barcode.php
+++ b/component/admin/tables/barcode.php
@@ -18,32 +18,32 @@
*/
class TableBarcode extends JTable
{
- /**
- * Primary Key
- *
- * @var integer
- */
- public $log_id = null;
+ /**
+ * Primary Key
+ *
+ * @var integer
+ */
+ public $log_id = null;
- /**
- * @var string
- */
- public $order_id = null;
+ /**
+ * @var string
+ */
+ public $order_id = null;
- public $user_id = null;
+ public $user_id = null;
- public $barcode = null;
+ public $barcode = null;
- public $search_date = null;
+ public $search_date = null;
- /**
- * Constructor
- *
- * @param object Database connector object
- */
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'orderbarcode_log', 'log_id', $db);
- }
+ /**
+ * Constructor
+ *
+ * @param object Database connector object
+ */
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
+ parent::__construct($this->_table_prefix . 'orderbarcode_log', 'log_id', $db);
+ }
}
diff --git a/component/admin/tables/catalog.php b/component/admin/tables/catalog.php
index 95ff80e23e5..9ea0f4a236c 100644
--- a/component/admin/tables/catalog.php
+++ b/component/admin/tables/catalog.php
@@ -18,17 +18,17 @@
*/
class RedshopTableCatalog extends RedshopTable
{
- /**
- * The table name without prefix.
- *
- * @var string
- */
- protected $_tableName = 'redshop_catalog';
+ /**
+ * The table name without prefix.
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_catalog';
- /**
- * The table key column
- *
- * @var string
- */
- protected $_tableKey = 'catalog_id';
+ /**
+ * The table key column
+ *
+ * @var string
+ */
+ protected $_tableKey = 'catalog_id';
}
diff --git a/component/admin/tables/catalog_request.php b/component/admin/tables/catalog_request.php
index d2423582279..9c5deee9e57 100644
--- a/component/admin/tables/catalog_request.php
+++ b/component/admin/tables/catalog_request.php
@@ -11,34 +11,33 @@
class Tablecatalog_request extends JTable
{
- public $catalog_user_id = null;
+ public $catalog_user_id = null;
- public $catalog_id = null;
+ public $catalog_id = null;
- public $name = null;
+ public $name = null;
- public $email = null;
+ public $email = null;
- public $registerDate = null;
+ public $registerDate = null;
- public $block = null;
+ public $block = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'catalog_request', 'catalog_user_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'catalog_request', 'catalog_user_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/category.php b/component/admin/tables/category.php
index 630fb2dc4a2..a088a5ffdf7 100644
--- a/component/admin/tables/category.php
+++ b/component/admin/tables/category.php
@@ -18,195 +18,182 @@
*/
class RedshopTableCategory extends RedshopTableNested
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_category';
-
- /**
- * @var integer
- */
- public $id;
-
- /**
- * @var string
- */
- public $name;
-
- /**
- * @var string
- */
- public $category_thumb_image;
-
- /**
- * @var string
- */
- public $description;
-
- /**
- * @var string
- */
- public $category_full_image;
-
- /**
- * @var string
- */
- public $metakey;
-
- /**
- * @var string
- */
- public $metadesc;
-
- /**
- * @var integer
- */
- public $template;
-
- /**
- * @var integer
- */
- public $published;
-
- /**
- * @var integer
- */
- public $category_pdate;
-
- /**
- * @var integer
- */
- public $products_per_page;
-
- /**
- * Event name to trigger after delete().
- *
- * @var string
- */
- protected $_eventAfterDelete = 'onAfterDeleteCategory';
-
- /**
- * @var integer
- */
- public $ordering;
-
- /**
- * Called delete().
- *
- * @param integer $pk The primary key of the node to delete.
- * @param boolean $children True to delete child nodes, false to move them up a level.
- *
- * @return boolean True on success.
- */
- protected function doDelete($pk = null, $children = true)
- {
- $db = $this->getDbo();
-
- // Check child category
- $query = $db->getQuery(true)
- ->select('COUNT(*) AS ctotal')
- ->select($db->qn('name'))
- ->from($db->qn('#__redshop_category'))
- ->where($db->qn('parent_id') . ' = ' . (int)$this->id);
-
- $childCount = $db->setQuery($query)->loadResult();
-
- if ($childCount > 0) {
- $this->setError(JText::sprintf('COM_REDSHOP_CATEGORY_PARENT_ERROR_MSG', $this->name, $this->id));
-
- return false;
- }
-
- // Check products
- $productCount = RedshopEntityCategory::getInstance($this->id)->productCount();
-
- if ($productCount > 0) {
- $this->setError(JText::sprintf('COM_REDSHOP_CATEGORY_EXIST_PRODUCT', $this->name, $this->id));
-
- return false;
- }
-
- // Remove thumb images.
- if (!empty($this->category_thumb_image)) {
- $thumbPath = REDSHOP_FRONT_IMAGES_RELPATH . 'category/thumb/' . $this->category_thumb_image;
-
- if (JFile::exists($thumbPath)) {
- JFile::delete($thumbPath);
- }
- }
-
- // Remove full images.
- if (!empty($this->category_full_image)) {
- $fullImagePath = REDSHOP_FRONT_IMAGES_RELPATH . 'category/thumb/' . $this->category_full_image;
-
- if (JFile::exists($fullImagePath)) {
- JFile::delete($fullImagePath);
- }
- }
-
- // Remove reference with products
- $query = $db->getQuery(true)
- ->delete($db->qn('#__redshop_product_category_xref'))
- ->where($db->qn('category_id') . ' = ' . $this->id);
- $db->setQuery($query)->execute();
-
- // Force do not delete child categories
- return parent::doDelete($pk, false);
- }
-
- /**
- * Do the database store.
- *
- * @param boolean $updateNulls True to update null values as well.
- *
- * @return boolean
- * @since 2.1.0
- */
- protected function doStore($updateNulls = false)
- {
- if (!parent::doStore($updateNulls)) {
- return false;
- }
-
- // Prepare target folder.
- \Redshop\Helper\Media::createFolder(REDSHOP_MEDIA_IMAGE_RELPATH . 'category/' . $this->id);
-
- // Prepare target folder.
- \Redshop\Helper\Media::createFolder(REDSHOP_MEDIA_IMAGE_RELPATH . 'category/' . $this->id . '/thumb');
-
- /** @var RedshopModelCategory $model */
- $model = RedshopModel::getInstance('Category', 'RedshopModel');
- $media = $this->getOption('media', array());
-
- if (!empty($media['category_full_image'])) {
- $model->storeMedia($this, $media['category_full_image'], 'full');
- }
-
- if (!empty($media['category_back_full_image'])) {
- $model->storeMedia($this, $media['category_back_full_image'], 'back');
- }
-
- return true;
- }
-
- /**
- * Called check().
- *
- * @return boolean True on success.
- * @throws Exception
- *
- * @since 2.1.0
- */
- protected function doCheck()
- {
- if (empty(trim($this->name))) {
- $this->setError(JText::_('COM_REDSHOP_TOOLTIP_CATEGORY_NAME'));
-
- return false;
- }
-
- return parent::doCheck();
- }
+ /**
+ * @var integer
+ */
+ public $id;
+ /**
+ * @var string
+ */
+ public $name;
+ /**
+ * @var string
+ */
+ public $category_thumb_image;
+ /**
+ * @var string
+ */
+ public $description;
+ /**
+ * @var string
+ */
+ public $category_full_image;
+ /**
+ * @var string
+ */
+ public $metakey;
+ /**
+ * @var string
+ */
+ public $metadesc;
+ /**
+ * @var integer
+ */
+ public $template;
+ /**
+ * @var integer
+ */
+ public $published;
+ /**
+ * @var integer
+ */
+ public $category_pdate;
+ /**
+ * @var integer
+ */
+ public $products_per_page;
+ /**
+ * @var integer
+ */
+ public $ordering;
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_category';
+ /**
+ * Event name to trigger after delete().
+ *
+ * @var string
+ */
+ protected $_eventAfterDelete = 'onAfterDeleteCategory';
+
+ /**
+ * Called delete().
+ *
+ * @param integer $pk The primary key of the node to delete.
+ * @param boolean $children True to delete child nodes, false to move them up a level.
+ *
+ * @return boolean True on success.
+ */
+ protected function doDelete($pk = null, $children = true)
+ {
+ $db = $this->getDbo();
+
+ // Check child category
+ $query = $db->getQuery(true)
+ ->select('COUNT(*) AS ctotal')
+ ->select($db->qn('name'))
+ ->from($db->qn('#__redshop_category'))
+ ->where($db->qn('parent_id') . ' = ' . (int)$this->id);
+
+ $childCount = $db->setQuery($query)->loadResult();
+
+ if ($childCount > 0) {
+ $this->setError(JText::sprintf('COM_REDSHOP_CATEGORY_PARENT_ERROR_MSG', $this->name, $this->id));
+
+ return false;
+ }
+
+ // Check products
+ $productCount = RedshopEntityCategory::getInstance($this->id)->productCount();
+
+ if ($productCount > 0) {
+ $this->setError(JText::sprintf('COM_REDSHOP_CATEGORY_EXIST_PRODUCT', $this->name, $this->id));
+
+ return false;
+ }
+
+ // Remove thumb images.
+ if (!empty($this->category_thumb_image)) {
+ $thumbPath = REDSHOP_FRONT_IMAGES_RELPATH . 'category/thumb/' . $this->category_thumb_image;
+
+ if (JFile::exists($thumbPath)) {
+ JFile::delete($thumbPath);
+ }
+ }
+
+ // Remove full images.
+ if (!empty($this->category_full_image)) {
+ $fullImagePath = REDSHOP_FRONT_IMAGES_RELPATH . 'category/thumb/' . $this->category_full_image;
+
+ if (JFile::exists($fullImagePath)) {
+ JFile::delete($fullImagePath);
+ }
+ }
+
+ // Remove reference with products
+ $query = $db->getQuery(true)
+ ->delete($db->qn('#__redshop_product_category_xref'))
+ ->where($db->qn('category_id') . ' = ' . $this->id);
+ $db->setQuery($query)->execute();
+
+ // Force do not delete child categories
+ return parent::doDelete($pk, false);
+ }
+
+ /**
+ * Do the database store.
+ *
+ * @param boolean $updateNulls True to update null values as well.
+ *
+ * @return boolean
+ * @since 2.1.0
+ */
+ protected function doStore($updateNulls = false)
+ {
+ if (!parent::doStore($updateNulls)) {
+ return false;
+ }
+
+ // Prepare target folder.
+ \Redshop\Helper\Media::createFolder(REDSHOP_MEDIA_IMAGE_RELPATH . 'category/' . $this->id);
+
+ // Prepare target folder.
+ \Redshop\Helper\Media::createFolder(REDSHOP_MEDIA_IMAGE_RELPATH . 'category/' . $this->id . '/thumb');
+
+ /** @var RedshopModelCategory $model */
+ $model = RedshopModel::getInstance('Category', 'RedshopModel');
+ $media = $this->getOption('media', array());
+
+ if (!empty($media['category_full_image'])) {
+ $model->storeMedia($this, $media['category_full_image'], 'full');
+ }
+
+ if (!empty($media['category_back_full_image'])) {
+ $model->storeMedia($this, $media['category_back_full_image'], 'back');
+ }
+
+ return true;
+ }
+
+ /**
+ * Called check().
+ *
+ * @return boolean True on success.
+ * @throws Exception
+ *
+ * @since 2.1.0
+ */
+ protected function doCheck()
+ {
+ if (empty(trim($this->name))) {
+ $this->setError(JText::_('COM_REDSHOP_TOOLTIP_CATEGORY_NAME'));
+
+ return false;
+ }
+
+ return parent::doCheck();
+ }
}
diff --git a/component/admin/tables/country.php b/component/admin/tables/country.php
index 7bc81052854..d273307ee15 100644
--- a/component/admin/tables/country.php
+++ b/component/admin/tables/country.php
@@ -18,74 +18,74 @@
*/
class RedshopTableCountry extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_country';
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_country';
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (!parent::doCheck())
- {
- return false;
- }
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (!parent::doCheck()) {
+ return false;
+ }
- if (empty($this->country_name))
- {
- return false;
- }
+ if (empty($this->country_name)) {
+ return false;
+ }
- if (empty($this->country_3_code))
- {
- return false;
- }
+ if (empty($this->country_3_code)) {
+ return false;
+ }
- if (empty($this->country_2_code))
- {
- return false;
- }
+ if (empty($this->country_2_code)) {
+ return false;
+ }
- $db = JFactory::getDbo();
- $query = $db->getQuery(true);
- $query->select($db->qn(array('id', 'country_3_code')))
- ->from($db->qn('#__redshop_country'))
- ->where($db->qn('country_3_code') . ' = ' . $db->quote($this->country_3_code) . ' AND ' . $db->qn('id') . ' != ' . $db->q($this->id));
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true);
+ $query->select($db->qn(array('id', 'country_3_code')))
+ ->from($db->qn('#__redshop_country'))
+ ->where(
+ $db->qn('country_3_code') . ' = ' . $db->quote($this->country_3_code) . ' AND ' . $db->qn(
+ 'id'
+ ) . ' != ' . $db->q($this->id)
+ );
- $xid = $db->setQuery($query)->loadResult();
+ $xid = $db->setQuery($query)->loadResult();
- if ($xid)
- {
- $this->setError(JText::_('COM_REDSHOP_COUNTRY_CODE_3_ALREADY_EXISTS'));
+ if ($xid) {
+ $this->setError(JText::_('COM_REDSHOP_COUNTRY_CODE_3_ALREADY_EXISTS'));
- return false;
- }
- else
- {
- $query = $db->getQuery(true);
- $query->select($db->qn(array('id', 'country_3_code', 'country_2_code')))
- ->from($db->qn('#__redshop_country'))
- ->where($db->qn('country_2_code') . ' = ' . $db->q($this->country_2_code) . ' AND ' . $db->qn('id') . ' != ' . $db->q($this->id));
+ return false;
+ } else {
+ $query = $db->getQuery(true);
+ $query->select($db->qn(array('id', 'country_3_code', 'country_2_code')))
+ ->from($db->qn('#__redshop_country'))
+ ->where(
+ $db->qn('country_2_code') . ' = ' . $db->q($this->country_2_code) . ' AND ' . $db->qn(
+ 'id'
+ ) . ' != ' . $db->q($this->id)
+ );
- $xid = $db->setQuery($query)->loadResult();
+ $xid = $db->setQuery($query)->loadResult();
- if ($xid)
- {
- $this->setError(JText::_('COM_REDSHOP_COUNTRY_CODE_2_ALREADY_EXISTS'));
+ if ($xid) {
+ $this->setError(JText::_('COM_REDSHOP_COUNTRY_CODE_2_ALREADY_EXISTS'));
- return false;
- }
- }
+ return false;
+ }
+ }
- return true;
- }
+ return true;
+ }
}
diff --git a/component/admin/tables/coupon.php b/component/admin/tables/coupon.php
index 97993bc47f3..59ea0526a23 100644
--- a/component/admin/tables/coupon.php
+++ b/component/admin/tables/coupon.php
@@ -13,170 +13,146 @@
* Table Coupon
*
* @package RedSHOP.Backend
- * @subpackage Table
+ * @subpackage Table
* @since 2.1.0
*/
class RedshopTableCoupon extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_coupons';
-
- /**
- * @var integer
- */
- public $id;
-
- /**
- * @var string
- */
- public $code;
-
- /**
- * @var integer
- */
- public $type = 0;
-
- /**
- * @var float
- */
- public $value = 0.00;
-
- /**
- * @var string
- */
- public $start_date = '0000-00-00 00:00:00';
-
- /**
- * @var string
- */
- public $end_date = '0000-00-00 00:00:00';
-
- /**
- * @var integer
- */
- public $effect = 0;
-
- /**
- * @var integer
- */
- public $userid;
-
- /**
- * @var integer
- */
- public $amount_left;
-
- /**
- * @var integer
- */
- public $published;
-
- /**
- * @var integer
- */
- public $subtotal;
-
- /**
- * @var integer
- */
- public $order_id;
-
- /**
- * @var integer
- */
- public $free_shipping;
-
- /**
- * @var integer
- */
- public $created_by;
-
- /**
- * @var string
- */
- public $created_date = '0000-00-00 00:00:00';
-
- /**
- * @var integer
- */
- public $checked_out;
-
- /**
- * @var string
- */
- public $checked_out_time = '0000-00-00 00:00:00';
-
- /**
- * @var integer
- */
- public $modified_by;
-
- /**
- * @var string
- */
- public $modified_date = '0000-00-00 00:00:00';
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (!parent::doCheck())
- {
- return false;
- }
-
- if (empty($this->code))
- {
- return false;
- }
-
- if (empty($this->value))
- {
- return false;
- }
-
- $db = $this->getDbo();
-
- // Check duplicate.
- $code = $this->get('code');
-
- $voucherQuery = $db->getQuery(true)
- ->select($db->qn('code'))
- ->from($db->qn('#__redshop_voucher'));
-
- $couponQuery = $db->getQuery(true)
- ->select($db->qn('code'))
- ->from($db->qn('#__redshop_coupons'));
-
- if ($this->hasPrimaryKey())
- {
- $couponQuery->where($db->qn('id') . ' <> ' . $this->id);
- }
-
- $couponQuery->union($voucherQuery);
-
- $query = $db->getQuery(true)
- ->select('COUNT(*)')
- ->from('(' . $couponQuery . ') AS ' . $db->qn('data'))
- ->where($db->qn('data.code') . ' = ' . $db->quote($code));
-
- if ($db->setQuery($query)->loadResult())
- {
- $this->setError(JText::_('COM_REDSHOP_COUPON_ERROR_CODE_ALREADY_EXIST'));
-
- return false;
- }
-
- return true;
- }
+ /**
+ * @var integer
+ */
+ public $id;
+ /**
+ * @var string
+ */
+ public $code;
+ /**
+ * @var integer
+ */
+ public $type = 0;
+ /**
+ * @var float
+ */
+ public $value = 0.00;
+ /**
+ * @var string
+ */
+ public $start_date = '0000-00-00 00:00:00';
+ /**
+ * @var string
+ */
+ public $end_date = '0000-00-00 00:00:00';
+ /**
+ * @var integer
+ */
+ public $effect = 0;
+ /**
+ * @var integer
+ */
+ public $userid;
+ /**
+ * @var integer
+ */
+ public $amount_left;
+ /**
+ * @var integer
+ */
+ public $published;
+ /**
+ * @var integer
+ */
+ public $subtotal;
+ /**
+ * @var integer
+ */
+ public $order_id;
+ /**
+ * @var integer
+ */
+ public $free_shipping;
+ /**
+ * @var integer
+ */
+ public $created_by;
+ /**
+ * @var string
+ */
+ public $created_date = '0000-00-00 00:00:00';
+ /**
+ * @var integer
+ */
+ public $checked_out;
+ /**
+ * @var string
+ */
+ public $checked_out_time = '0000-00-00 00:00:00';
+ /**
+ * @var integer
+ */
+ public $modified_by;
+ /**
+ * @var string
+ */
+ public $modified_date = '0000-00-00 00:00:00';
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_coupons';
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (!parent::doCheck()) {
+ return false;
+ }
+
+ if (empty($this->code)) {
+ return false;
+ }
+
+ if (empty($this->value)) {
+ return false;
+ }
+
+ $db = $this->getDbo();
+
+ // Check duplicate.
+ $code = $this->get('code');
+
+ $voucherQuery = $db->getQuery(true)
+ ->select($db->qn('code'))
+ ->from($db->qn('#__redshop_voucher'));
+
+ $couponQuery = $db->getQuery(true)
+ ->select($db->qn('code'))
+ ->from($db->qn('#__redshop_coupons'));
+
+ if ($this->hasPrimaryKey()) {
+ $couponQuery->where($db->qn('id') . ' <> ' . $this->id);
+ }
+
+ $couponQuery->union($voucherQuery);
+
+ $query = $db->getQuery(true)
+ ->select('COUNT(*)')
+ ->from('(' . $couponQuery . ') AS ' . $db->qn('data'))
+ ->where($db->qn('data.code') . ' = ' . $db->quote($code));
+
+ if ($db->setQuery($query)->loadResult()) {
+ $this->setError(JText::_('COM_REDSHOP_COUPON_ERROR_CODE_ALREADY_EXIST'));
+
+ return false;
+ }
+
+ return true;
+ }
}
diff --git a/component/admin/tables/currency.php b/component/admin/tables/currency.php
index c0a73f13beb..d0c6fac4a93 100644
--- a/component/admin/tables/currency.php
+++ b/component/admin/tables/currency.php
@@ -18,126 +18,113 @@
*/
class RedshopTableCurrency extends RedshopTable
{
- /**
- * @var string
- */
- protected $_tableName = 'redshop_currency';
-
- /**
- * @var integer
- */
- public $id;
-
- /**
- * @var string
- */
- public $name;
-
- /**
- * @var string
- */
- public $code;
-
- /**
- * @var integer
- */
- public $created_by;
-
- /**
- * @var string
- */
- public $created_date = '0000-00-00 00:00:00';
-
- /**
- * @var integer
- */
- public $checked_out;
-
- /**
- * @var string
- */
- public $checked_out_time = '0000-00-00 00:00:00';
-
- /**
- * @var integer
- */
- public $modified_by;
-
- /**
- * @var string
- */
- public $modified_date = '0000-00-00 00:00:00';
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (!parent::doCheck())
- {
- return false;
- }
-
- if (empty(trim($this->name)))
- {
- return false;
- }
-
- if (empty(trim($this->code)))
- {
- return false;
- }
-
- $db = $this->getDbo();
-
- // Check duplicate.
- $code = $this->get('code');
-
- $codeQuery = $db->getQuery(true)
- ->select($db->qn('code'))
- ->from($db->qn('#__' . $this->_tableName));
-
- if ($this->hasPrimaryKey())
- {
- $codeQuery->where($db->qn('id') . ' <> ' . $this->id);
- }
-
- $query = $db->getQuery(true)
- ->select('COUNT(*)')
- ->from('(' . $codeQuery . ') AS ' . $db->qn('data'))
- ->where($db->qn('data.code') . ' = ' . $db->q($code));
-
- if ($db->setQuery($query)->loadResult())
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_CURRENCY_CODE_ALREADY_EXISTS'));
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Delete one or more registers
- *
- * @param mixed $pk Array of ids or ids comma separated
- *
- * @return boolean Deleted successfully?
- */
- protected function doDelete($pk = null)
- {
- if (Redshop::getConfig()->get('CURRENCY_CODE') == $this->code)
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_CURRENCY_ERROR_DELETE_CURRENCY_SET_IN_CONFIG'));
-
- return false;
- }
-
- return parent::doDelete();
- }
+ /**
+ * @var integer
+ */
+ public $id;
+ /**
+ * @var string
+ */
+ public $name;
+ /**
+ * @var string
+ */
+ public $code;
+ /**
+ * @var integer
+ */
+ public $created_by;
+ /**
+ * @var string
+ */
+ public $created_date = '0000-00-00 00:00:00';
+ /**
+ * @var integer
+ */
+ public $checked_out;
+ /**
+ * @var string
+ */
+ public $checked_out_time = '0000-00-00 00:00:00';
+ /**
+ * @var integer
+ */
+ public $modified_by;
+ /**
+ * @var string
+ */
+ public $modified_date = '0000-00-00 00:00:00';
+ /**
+ * @var string
+ */
+ protected $_tableName = 'redshop_currency';
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (!parent::doCheck()) {
+ return false;
+ }
+
+ if (empty(trim($this->name))) {
+ return false;
+ }
+
+ if (empty(trim($this->code))) {
+ return false;
+ }
+
+ $db = $this->getDbo();
+
+ // Check duplicate.
+ $code = $this->get('code');
+
+ $codeQuery = $db->getQuery(true)
+ ->select($db->qn('code'))
+ ->from($db->qn('#__' . $this->_tableName));
+
+ if ($this->hasPrimaryKey()) {
+ $codeQuery->where($db->qn('id') . ' <> ' . $this->id);
+ }
+
+ $query = $db->getQuery(true)
+ ->select('COUNT(*)')
+ ->from('(' . $codeQuery . ') AS ' . $db->qn('data'))
+ ->where($db->qn('data.code') . ' = ' . $db->q($code));
+
+ if ($db->setQuery($query)->loadResult()) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_CURRENCY_CODE_ALREADY_EXISTS'));
+
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Delete one or more registers
+ *
+ * @param mixed $pk Array of ids or ids comma separated
+ *
+ * @return boolean Deleted successfully?
+ */
+ protected function doDelete($pk = null)
+ {
+ if (Redshop::getConfig()->get('CURRENCY_CODE') == $this->code) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_CURRENCY_ERROR_DELETE_CURRENCY_SET_IN_CONFIG'));
+
+ return false;
+ }
+
+ return parent::doDelete();
+ }
}
diff --git a/component/admin/tables/discount.php b/component/admin/tables/discount.php
index 0aa75500fd2..aa99f559b32 100644
--- a/component/admin/tables/discount.php
+++ b/component/admin/tables/discount.php
@@ -18,233 +18,218 @@
*/
class RedshopTableDiscount extends RedshopTable
{
- /**
- * The table name without the prefix.
- *
- * @var string
- */
- protected $_tableName = 'redshop_discount';
-
- /**
- * The table key column. Usually: id
- *
- * @var string
- */
- protected $_tableKey = 'discount_id';
-
- /**
- * @var integer
- */
- public $discount_id;
-
- /**
- * @var string
- */
- public $name;
-
- /**
- * @var integer
- */
- public $amount = 0;
-
- /**
- * @var integer
- */
- public $condition = 1;
-
- /**
- * @var float
- */
- public $discount_amount = 0.0;
-
- /**
- * @var integer
- */
- public $discount_type = 0;
-
- /**
- * @var string
- */
- public $start_date;
-
- /**
- * @var string
- */
- public $end_date;
-
- /**
- * @var integer
- */
- public $published = 1;
-
- /**
- * Do the database store.
- *
- * @param boolean $updateNulls True to update null values as well.
- *
- * @return boolean
- */
- protected function doStore($updateNulls = false)
- {
- if (!parent::doStore($updateNulls))
- {
- return false;
- }
-
- if ($this->getOption('inlineMode', false) === true)
- {
- return true;
- }
-
- return $this->updateShopperGroups();
- }
-
- /**
- * Method for update shopper group xref.
- *
- * @return boolean
- */
- protected function updateShopperGroups()
- {
- $db = $this->getDbo();
-
- // Clear current reference products.
- $query = $db->getQuery(true)
- ->delete($db->qn('#__redshop_discount_shoppers'))
- ->where($db->qn('discount_id') . ' = ' . $this->discount_id);
- $db->setQuery($query)->execute();
-
- $shopperGroupIds = $this->getOption('shopperGroups', null);
-
- if (empty($shopperGroupIds) || empty(array_filter($shopperGroupIds)))
- {
- return true;
- }
-
- $query->clear()
- ->insert($db->qn('#__redshop_discount_shoppers'))
- ->columns($db->qn(array('discount_id', 'shopper_group_id')));
-
- foreach ($shopperGroupIds as $shopperGroupId)
- {
- $query->values((int) $this->discount_id . ',' . (int) $shopperGroupId);
- }
-
- return $db->setQuery($query)->execute();
- }
-
- /**
- * Method to bind an associative array or object to the JTable instance.This
- * method only binds properties that are publicly accessible and optionally
- * takes an array of properties to ignore when binding.
- *
- * @param mixed $src An associative array or object to bind to the JTable instance.
- * @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
- *
- * @return boolean True on success.
- *
- * @throws Exception
- */
- protected function doBind(&$src, $ignore = array())
- {
- if (isset($src['shopper_group']) && !empty($src['shopper_group']))
- {
- $shopperGroups = is_string($src['shopper_group']) ? explode(',', $src['shopper_group']) : $src['shopper_group'];
- $this->setOption('shopperGroups', array_filter($shopperGroups));
- unset($src['shopper_group']);
- }
-
- return parent::doBind($src, $ignore);
- }
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (empty($this->name))
- {
- return false;
- }
-
- // Check amount
- if ((float) $this->amount <= 0.0)
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_ERROR_AMOUNT_ZERO'));
-
- return false;
- }
-
- // Check discount amount
- if ((float) $this->discount_amount <= 0.0)
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_ERROR_DISCOUNT_AMOUNT_ZERO'));
-
- return false;
- }
-
- // Check amount and discount amount
- if (((float) $this->amount) < (float) $this->discount_amount)
- {
- /** @scrutinizer ignore-deprecated */
- $this->setError(JText::_('COM_REDSHOP_DISCOUNT_ERROR_AMOUNT_HIGHT_DISCOUNT_AMOUNT'));
-
- return false;
- }
-
- // If discount type is percent. Make sure discount amount not higher than 100.
- if ($this->discount_type == 1 && $this->discount_amount > 100)
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_ERROR_DISCOUNT_PERCENTAGE'));
-
- return false;
- }
-
- // If discount type is percent. Make sure discount amount not higher than 100.
- if (!empty($this->start_date) && !empty($this->end_date) && $this->start_date >= $this->end_date)
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_ERROR_START_DATE_SAME_HIGH_END_DATE'));
-
- return false;
- }
-
- // Check shopper groups
- if (empty($this->getOption('shopperGroups', array())))
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_ERROR_MISSING_SHOPPER_GROUPS'));
-
- return false;
- }
-
- return parent::doCheck();
- }
-
- /**
- * Delete one or more registers
- *
- * @param mixed $pk Array of ids or ids comma separated
- *
- * @return boolean Deleted successfully?
- */
- public function doDelete($pk = null)
- {
- $discountId = $this->discount_id;
-
- if (!parent::doDelete($pk))
- {
- return false;
- }
-
- $db = $this->getDbo();
- $query = $db->getQuery(true)
- ->delete($db->qn('#__redshop_discount_shoppers'))
- ->where($db->qn('discount_id') . ' = ' . $discountId);
-
- return $db->setQuery($query)->execute();
- }
+ /**
+ * @var integer
+ */
+ public $discount_id;
+ /**
+ * @var string
+ */
+ public $name;
+ /**
+ * @var integer
+ */
+ public $amount = 0;
+ /**
+ * @var integer
+ */
+ public $condition = 1;
+ /**
+ * @var float
+ */
+ public $discount_amount = 0.0;
+ /**
+ * @var integer
+ */
+ public $discount_type = 0;
+ /**
+ * @var string
+ */
+ public $start_date;
+ /**
+ * @var string
+ */
+ public $end_date;
+ /**
+ * @var integer
+ */
+ public $published = 1;
+ /**
+ * The table name without the prefix.
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_discount';
+ /**
+ * The table key column. Usually: id
+ *
+ * @var string
+ */
+ protected $_tableKey = 'discount_id';
+
+ /**
+ * Delete one or more registers
+ *
+ * @param mixed $pk Array of ids or ids comma separated
+ *
+ * @return boolean Deleted successfully?
+ */
+ public function doDelete($pk = null)
+ {
+ $discountId = $this->discount_id;
+
+ if (!parent::doDelete($pk)) {
+ return false;
+ }
+
+ $db = $this->getDbo();
+ $query = $db->getQuery(true)
+ ->delete($db->qn('#__redshop_discount_shoppers'))
+ ->where($db->qn('discount_id') . ' = ' . $discountId);
+
+ return $db->setQuery($query)->execute();
+ }
+
+ /**
+ * Do the database store.
+ *
+ * @param boolean $updateNulls True to update null values as well.
+ *
+ * @return boolean
+ */
+ protected function doStore($updateNulls = false)
+ {
+ if (!parent::doStore($updateNulls)) {
+ return false;
+ }
+
+ if ($this->getOption('inlineMode', false) === true) {
+ return true;
+ }
+
+ return $this->updateShopperGroups();
+ }
+
+ /**
+ * Method for update shopper group xref.
+ *
+ * @return boolean
+ */
+ protected function updateShopperGroups()
+ {
+ $db = $this->getDbo();
+
+ // Clear current reference products.
+ $query = $db->getQuery(true)
+ ->delete($db->qn('#__redshop_discount_shoppers'))
+ ->where($db->qn('discount_id') . ' = ' . $this->discount_id);
+ $db->setQuery($query)->execute();
+
+ $shopperGroupIds = $this->getOption('shopperGroups', null);
+
+ if (empty($shopperGroupIds) || empty(array_filter($shopperGroupIds))) {
+ return true;
+ }
+
+ $query->clear()
+ ->insert($db->qn('#__redshop_discount_shoppers'))
+ ->columns($db->qn(array('discount_id', 'shopper_group_id')));
+
+ foreach ($shopperGroupIds as $shopperGroupId) {
+ $query->values((int)$this->discount_id . ',' . (int)$shopperGroupId);
+ }
+
+ return $db->setQuery($query)->execute();
+ }
+
+ /**
+ * Method to bind an associative array or object to the JTable instance.This
+ * method only binds properties that are publicly accessible and optionally
+ * takes an array of properties to ignore when binding.
+ *
+ * @param mixed $src An associative array or object to bind to the JTable instance.
+ * @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
+ *
+ * @return boolean True on success.
+ *
+ * @throws Exception
+ */
+ protected function doBind(&$src, $ignore = array())
+ {
+ if (isset($src['shopper_group']) && !empty($src['shopper_group'])) {
+ $shopperGroups = is_string($src['shopper_group']) ? explode(
+ ',',
+ $src['shopper_group']
+ ) : $src['shopper_group'];
+ $this->setOption('shopperGroups', array_filter($shopperGroups));
+ unset($src['shopper_group']);
+ }
+
+ return parent::doBind($src, $ignore);
+ }
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (empty($this->name)) {
+ return false;
+ }
+
+ // Check amount
+ if ((float)$this->amount <= 0.0) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_ERROR_AMOUNT_ZERO'));
+
+ return false;
+ }
+
+ // Check discount amount
+ if ((float)$this->discount_amount <= 0.0) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_ERROR_DISCOUNT_AMOUNT_ZERO'));
+
+ return false;
+ }
+
+ // Check amount and discount amount
+ if (((float)$this->amount) < (float)$this->discount_amount) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_ERROR_AMOUNT_HIGHT_DISCOUNT_AMOUNT'));
+
+ return false;
+ }
+
+ // If discount type is percent. Make sure discount amount not higher than 100.
+ if ($this->discount_type == 1 && $this->discount_amount > 100) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_ERROR_DISCOUNT_PERCENTAGE'));
+
+ return false;
+ }
+
+ // If discount type is percent. Make sure discount amount not higher than 100.
+ if (!empty($this->start_date) && !empty($this->end_date) && $this->start_date >= $this->end_date) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_ERROR_START_DATE_SAME_HIGH_END_DATE'));
+
+ return false;
+ }
+
+ // Check shopper groups
+ if (empty($this->getOption('shopperGroups', array()))) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_ERROR_MISSING_SHOPPER_GROUPS'));
+
+ return false;
+ }
+
+ return parent::doCheck();
+ }
}
diff --git a/component/admin/tables/discount_product.php b/component/admin/tables/discount_product.php
index 93f433df48b..c2969752b21 100644
--- a/component/admin/tables/discount_product.php
+++ b/component/admin/tables/discount_product.php
@@ -18,228 +18,214 @@
*/
class RedshopTableDiscount_Product extends RedshopTable
{
- /**
- * The table name without the prefix.
- *
- * @var string
- */
- protected $_tableName = 'redshop_discount_product';
-
- /**
- * The table key column. Usually: id
- *
- * @var string
- */
- protected $_tableKey = 'discount_product_id';
-
- /**
- * @var integer
- */
- public $discount_product_id;
-
- /**
- * @var integer
- */
- public $amount = 0;
-
- /**
- * @var integer
- */
- public $condition = 1;
-
- /**
- * @var float
- */
- public $discount_amount = 0.0;
-
- /**
- * @var integer
- */
- public $discount_type = 0;
-
- /**
- * @var integer
- */
- public $start_date = 0;
-
- /**
- * @var integer
- */
- public $end_date = 0;
-
- /**
- * @var integer
- */
- public $published = 1;
-
- /**
- * @var string
- */
- public $category_ids = '';
-
- /**
- * Do the database store.
- *
- * @param boolean $updateNulls True to update null values as well.
- *
- * @return boolean
- */
- protected function doStore($updateNulls = false)
- {
- if (!parent::doStore($updateNulls))
- {
- return false;
- }
-
- if ($this->getOption('inlineMode', false) === true)
- {
- return true;
- }
-
- return $this->updateShopperGroups();
- }
-
- /**
- * Method for update shopper group xref.
- *
- * @return boolean
- */
- protected function updateShopperGroups()
- {
- $db = $this->getDbo();
-
- // Clear current reference products.
- $query = $db->getQuery(true)
- ->delete($db->qn('#__redshop_discount_product_shoppers'))
- ->where($db->qn('discount_product_id') . ' = ' . $this->discount_product_id);
- $db->setQuery($query)->execute();
-
- $shopperGroupIds = $this->getOption('shopperGroups', null);
-
- if (empty($shopperGroupIds) || empty(array_filter($shopperGroupIds)))
- {
- return true;
- }
-
- $query->clear()
- ->insert($db->qn('#__redshop_discount_product_shoppers'))
- ->columns($db->qn(array('discount_product_id', 'shopper_group_id')));
-
- foreach ($shopperGroupIds as $shopperGroupId)
- {
- $query->values((int) $this->discount_product_id . ',' . (int) $shopperGroupId);
- }
-
- return $db->setQuery($query)->execute();
- }
-
- /**
- * Method to bind an associative array or object to the JTable instance.This
- * method only binds properties that are publicly accessible and optionally
- * takes an array of properties to ignore when binding.
- *
- * @param mixed $src An associative array or object to bind to the JTable instance.
- * @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
- *
- * @return boolean True on success.
- *
- * @throws Exception
- */
- protected function doBind(&$src, $ignore = array())
- {
- if (isset($src['shopper_group']) && !empty($src['shopper_group']))
- {
- $shopperGroups = is_string($src['shopper_group']) ? explode(',', $src['shopper_group']) : $src['shopper_group'];
- $this->setOption('shopperGroups', array_values(array_filter($shopperGroups)));
- unset($src['shopper_group']);
- }
-
- return parent::doBind($src, $ignore);
- }
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- // Check amount
- if ((float) $this->amount <= 0.0)
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_PRODUCT_ERROR_AMOUNT_ZERO'));
-
- return false;
- }
-
- // Check discount amount
- if ((float) $this->discount_amount <= 0.0)
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_PRODUCT_ERROR_DISCOUNT_AMOUNT_ZERO'));
-
- return false;
- }
-
- // Check amount and discount amount
- if (((float) $this->amount) < (float) $this->discount_amount)
- {
- /** @scrutinizer ignore-deprecated */
- $this->setError(JText::_('COM_REDSHOP_DISCOUNT_PRODUCT_ERROR_AMOUNT_HIGHT_DISCOUNT_AMOUNT'));
-
- return false;
- }
-
- // If discount type is percent. Make sure discount amount not higher than 100.
- if ($this->discount_type == 1 && $this->discount_amount > 100)
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_PRODUCT_ERROR_DISCOUNT_PERCENTAGE'));
-
- return false;
- }
-
- // Make sure start date always lower than end date.
- if (!empty($this->start_date) && !empty($this->end_date) && $this->start_date > $this->end_date)
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_PRODUCT_ERROR_START_DATE_SAME_HIGH_END_DATE'));
-
- return false;
- }
-
- // Check shopper groups
- if (empty($this->getOption('shopperGroups', array())))
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_PRODUCT_ERROR_MISSING_SHOPPER_GROUPS'));
-
- return false;
- }
-
- return parent::doCheck();
- }
-
- /**
- * Delete one or more registers
- *
- * @param mixed $pk Array of ids or ids comma separated
- *
- * @return boolean Deleted successfully?
- */
- public function doDelete($pk = null)
- {
- $discountProductId = $this->discount_product_id;
-
- if (!parent::doDelete($pk))
- {
- return false;
- }
-
- $db = $this->getDbo();
- $query = $db->getQuery(true)
- ->delete($db->qn('#__redshop_discount_product_shoppers'))
- ->where($db->qn('discount_product_id') . ' = ' . $discountProductId);
-
- return $db->setQuery($query)->execute();
- }
+ /**
+ * @var integer
+ */
+ public $discount_product_id;
+ /**
+ * @var integer
+ */
+ public $amount = 0;
+ /**
+ * @var integer
+ */
+ public $condition = 1;
+ /**
+ * @var float
+ */
+ public $discount_amount = 0.0;
+ /**
+ * @var integer
+ */
+ public $discount_type = 0;
+ /**
+ * @var integer
+ */
+ public $start_date = 0;
+ /**
+ * @var integer
+ */
+ public $end_date = 0;
+ /**
+ * @var integer
+ */
+ public $published = 1;
+ /**
+ * @var string
+ */
+ public $category_ids = '';
+ /**
+ * The table name without the prefix.
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_discount_product';
+ /**
+ * The table key column. Usually: id
+ *
+ * @var string
+ */
+ protected $_tableKey = 'discount_product_id';
+
+ /**
+ * Delete one or more registers
+ *
+ * @param mixed $pk Array of ids or ids comma separated
+ *
+ * @return boolean Deleted successfully?
+ */
+ public function doDelete($pk = null)
+ {
+ $discountProductId = $this->discount_product_id;
+
+ if (!parent::doDelete($pk)) {
+ return false;
+ }
+
+ $db = $this->getDbo();
+ $query = $db->getQuery(true)
+ ->delete($db->qn('#__redshop_discount_product_shoppers'))
+ ->where($db->qn('discount_product_id') . ' = ' . $discountProductId);
+
+ return $db->setQuery($query)->execute();
+ }
+
+ /**
+ * Do the database store.
+ *
+ * @param boolean $updateNulls True to update null values as well.
+ *
+ * @return boolean
+ */
+ protected function doStore($updateNulls = false)
+ {
+ if (!parent::doStore($updateNulls)) {
+ return false;
+ }
+
+ if ($this->getOption('inlineMode', false) === true) {
+ return true;
+ }
+
+ return $this->updateShopperGroups();
+ }
+
+ /**
+ * Method for update shopper group xref.
+ *
+ * @return boolean
+ */
+ protected function updateShopperGroups()
+ {
+ $db = $this->getDbo();
+
+ // Clear current reference products.
+ $query = $db->getQuery(true)
+ ->delete($db->qn('#__redshop_discount_product_shoppers'))
+ ->where($db->qn('discount_product_id') . ' = ' . $this->discount_product_id);
+ $db->setQuery($query)->execute();
+
+ $shopperGroupIds = $this->getOption('shopperGroups', null);
+
+ if (empty($shopperGroupIds) || empty(array_filter($shopperGroupIds))) {
+ return true;
+ }
+
+ $query->clear()
+ ->insert($db->qn('#__redshop_discount_product_shoppers'))
+ ->columns($db->qn(array('discount_product_id', 'shopper_group_id')));
+
+ foreach ($shopperGroupIds as $shopperGroupId) {
+ $query->values((int)$this->discount_product_id . ',' . (int)$shopperGroupId);
+ }
+
+ return $db->setQuery($query)->execute();
+ }
+
+ /**
+ * Method to bind an associative array or object to the JTable instance.This
+ * method only binds properties that are publicly accessible and optionally
+ * takes an array of properties to ignore when binding.
+ *
+ * @param mixed $src An associative array or object to bind to the JTable instance.
+ * @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
+ *
+ * @return boolean True on success.
+ *
+ * @throws Exception
+ */
+ protected function doBind(&$src, $ignore = array())
+ {
+ if (isset($src['shopper_group']) && !empty($src['shopper_group'])) {
+ $shopperGroups = is_string($src['shopper_group']) ? explode(
+ ',',
+ $src['shopper_group']
+ ) : $src['shopper_group'];
+ $this->setOption('shopperGroups', array_values(array_filter($shopperGroups)));
+ unset($src['shopper_group']);
+ }
+
+ return parent::doBind($src, $ignore);
+ }
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ // Check amount
+ if ((float)$this->amount <= 0.0) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_PRODUCT_ERROR_AMOUNT_ZERO'));
+
+ return false;
+ }
+
+ // Check discount amount
+ if ((float)$this->discount_amount <= 0.0) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_PRODUCT_ERROR_DISCOUNT_AMOUNT_ZERO'));
+
+ return false;
+ }
+
+ // Check amount and discount amount
+ if (((float)$this->amount) < (float)$this->discount_amount) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_PRODUCT_ERROR_AMOUNT_HIGHT_DISCOUNT_AMOUNT'));
+
+ return false;
+ }
+
+ // If discount type is percent. Make sure discount amount not higher than 100.
+ if ($this->discount_type == 1 && $this->discount_amount > 100) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_PRODUCT_ERROR_DISCOUNT_PERCENTAGE'));
+
+ return false;
+ }
+
+ // Make sure start date always lower than end date.
+ if (!empty($this->start_date) && !empty($this->end_date) && $this->start_date > $this->end_date) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_PRODUCT_ERROR_START_DATE_SAME_HIGH_END_DATE'));
+
+ return false;
+ }
+
+ // Check shopper groups
+ if (empty($this->getOption('shopperGroups', array()))) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_DISCOUNT_PRODUCT_ERROR_MISSING_SHOPPER_GROUPS'));
+
+ return false;
+ }
+
+ return parent::doCheck();
+ }
}
diff --git a/component/admin/tables/field.php b/component/admin/tables/field.php
index f0d97e2eaaf..6a92e106adc 100755
--- a/component/admin/tables/field.php
+++ b/component/admin/tables/field.php
@@ -9,6 +9,7 @@
defined('_JEXEC') or die;
JLoader::import('redshop.library');
+
/**
* Table Field
*
@@ -18,311 +19,274 @@
*/
class RedshopTableField extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_fields';
-
- /**
- * @var integer
- */
- public $id;
-
- /**
- * @var string
- */
- public $name;
-
- /**
- * @var integer
- */
- public $type;
-
- /**
- * @var integer
- */
- public $groupId;
-
- /**
- * @var integer
- */
- public $ordering;
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (empty($this->name))
- {
- return false;
- }
-
- if (empty($this->title))
- {
- return false;
- }
-
- if (!parent::doCheck())
- {
- return false;
- }
-
- $this->name = str_replace(" ", "_", $this->name);
-
- // Set 'rs' prefix to field name
- list($prefix) = explode("_", $this->name);
-
- if ($prefix != 'rs')
- {
- $this->name = "rs_" . $this->name;
- }
-
- $db = JFactory::getDbo();
-
- $query = $db->getQuery(true)
- ->select('COUNT(*) AS cnt')
- ->from($db->qn('#__redshop_fields'))
- ->where($db->qn('name') . ' = ' . $db->quote($this->name))
- ->where($db->qn('id') . ' != ' . (int) $this->id);
-
- $db->setQuery($query);
- $result = $db->loadResult();
-
- if ((boolean) $result)
- {
- $this->setError(JText::_('COM_REDSHOP_FIELDS_ALLREADY_EXIST'));
-
- return false;
- }
-
- if (!$this->id)
- {
- $query = $db->getQuery(true)
- ->select('COUNT(*) + 1')
- ->from($db->qn('#__redshop_fields'));
-
- $this->ordering = (int) $db->setQuery($query)->loadResult();
- }
-
- return true;
- }
-
- /**
- * Do the database store.
- *
- * @param boolean $updateNulls True to update null values as well.
- *
- * @return boolean
- * @throws Exception
- */
- protected function doStore($updateNulls = false)
- {
- if (!$this->groupId)
- {
- $this->groupId = null;
- }
-
- if (!parent::doStore($updateNulls))
- {
- return false;
- }
-
- if ($this->type == 0 || $this->type == RedshopHelperExtrafields::TYPE_TEXT || $this->type == RedshopHelperExtrafields::TYPE_TEXT_AREA)
- {
- $id[] = (int) $this->id;
- $this->deleteFieldValues($id, 'field_id');
- }
- else
- {
- $this->saveFieldValues($this->id);
- }
-
- return true;
- }
-
- /**
- * Delete one or more registers
- *
- * @param mixed $pk Array of ids or ids comma separated
- *
- * @return boolean Deleted successfully?
- */
- protected function doDelete($pk = null)
- {
- $db = $this->getDbo();
-
- if (!parent::doDelete($pk))
- {
- return false;
- }
-
- if (is_array($pk))
- {
- $pk = implode(',', $pk);
- }
-
- // Remove fields_data
- $query = $db->getQuery(true)
- ->delete($db->qn('#__redshop_fields_data'))
- ->where($db->qn('fieldid') . ' IN (' . $pk . ')');
-
- $db->setQuery($query);
-
- if (!$db->execute())
- {
- $this->setError($db->getErrorMsg());
- }
-
- return true;
- }
-
- /**
- * Method to delete all values related to a field or array of fields
- *
- * @param array $ids An array of field ids.
- * @param string $field The field column to check for deleting.
- *
- * @return boolean True if successful, false if an error occurs.
- *
- * @since 2.0.6
- */
- protected function deleteFieldValues($ids, $field)
- {
- $db = $this->getDbo();
- $ids = implode(',', $ids);
-
- $query = $db->getQuery(true)
- ->delete($db->qn('#__redshop_fields_value'))
- ->where($db->qn($field) . ' IN (' . $ids . ')');
-
- if (!$db->setQuery($query)->execute())
- {
- $this->setError($db->getErrorMsg());
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Method to save all values related to a field
- *
- * @param int $id Id of field.
- *
- * @return boolean True if successful, false if an error occurs.
- * @throws Exception
- *
- * @since 2.0.6
- */
- protected function saveFieldValues($id)
- {
- $db = JFactory::getDbo();
- $valueIds = array();
- $extraNames = array();
- $extraValues = array();
-
- // Get input
- $app = JFactory::getApplication();
- $post = $app->input->post;
- $total = 0;
-
- if (is_array($post->get('value_id')))
- {
- $extraValues = $post->getString('extra_value', '');
- $valueIds = $post->get('value_id', array(), 'array');
-
- if ($this->type == RedshopHelperExtrafields::TYPE_IMAGE_SELECT || $this->type == RedshopHelperExtrafields::TYPE_IMAGE_WITH_LINK)
- {
- $extraNames = JFactory::getApplication()->input->files->get('extra_name_file', array(), 'array');
- $total = count((array)$extraNames);
- }
- else
- {
- $extraNames = $post->get('extra_name', '', 'raw');
- $total = count((array) $extraNames);
- }
- }
-
- // Do not reset values if we are ordering
- $task = $app->input->get('task');
-
- if ($task != 'fields.saveOrderAjax' && $task != 'saveOrderAjax')
- {
- $fieldDataIds = RedshopEntityField::getInstance($id)->getFieldValues();
-
- if (count($fieldDataIds) > 0)
- {
- $fid = array();
-
- foreach ($fieldDataIds as $fieldDataId)
- {
- $fid[] = $fieldDataId->value_id;
- }
-
- $delFieldIds = array_diff($fid, $valueIds);
-
- if (count($delFieldIds) > 0)
- {
- $this->deleteFieldValues($delFieldIds, 'value_id');
- }
- }
- }
-
- for ($j = 0; $j < $total; $j++)
- {
- $filename = $extraNames[$j];
-
- if ($this->type == RedshopHelperExtrafields::TYPE_IMAGE_SELECT || $this->type == RedshopHelperExtrafields::TYPE_IMAGE_WITH_LINK)
- {
- if ($extraValues[$j] != "" && $extraNames[$j]['name'] != "" && $extraNames[$j]['error'] == 0)
- {
- $filename = RedshopHelperMedia::cleanFileName($extraNames[$j]['name']);
-
- $source = $extraNames[$j]['tmp_name'];
- $destination = REDSHOP_FRONT_IMAGES_RELPATH . 'extrafield/' . $filename;
-
- JFile::upload($source, $destination);
- }
- }
-
- if ($extraNames[$j]['error'] == 0 || !isset($extraNames[$j]['error']))
- {
- if (empty($valueIds[$j]))
- {
- $obj = new stdClass;
- $obj->field_id = (int)$id;
- $obj->field_name = $filename;
- $obj->field_value = $extraValues[$j];
- $db->insertObject('#__redshop_fields_value', $obj);
- }
- else
- {
- $obj = new stdClass;
- $obj->value_id = $valueIds[$j];
- $obj->field_value = $extraValues[$j];
- $obj->field_name = $filename;
- $db->updateObject('#__redshop_fields_value', $obj, array('value_id'));
- }
- }
- else
- {
- $obj = new stdClass;
- $obj->value_id = $valueIds[$j];
- $obj->field_value = $extraValues[$j];
- $obj->field_name = $filename;
- $db->updateObject('#__redshop_fields_value', $obj,array('value_id'));
- }
- }
-
- return true;
- }
+ /**
+ * @var integer
+ */
+ public $id;
+ /**
+ * @var string
+ */
+ public $name;
+ /**
+ * @var integer
+ */
+ public $type;
+ /**
+ * @var integer
+ */
+ public $groupId;
+ /**
+ * @var integer
+ */
+ public $ordering;
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_fields';
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (empty($this->name)) {
+ return false;
+ }
+
+ if (empty($this->title)) {
+ return false;
+ }
+
+ if (!parent::doCheck()) {
+ return false;
+ }
+
+ $this->name = str_replace(" ", "_", $this->name);
+
+ // Set 'rs' prefix to field name
+ list($prefix) = explode("_", $this->name);
+
+ if ($prefix != 'rs') {
+ $this->name = "rs_" . $this->name;
+ }
+
+ $db = JFactory::getDbo();
+
+ $query = $db->getQuery(true)
+ ->select('COUNT(*) AS cnt')
+ ->from($db->qn('#__redshop_fields'))
+ ->where($db->qn('name') . ' = ' . $db->quote($this->name))
+ ->where($db->qn('id') . ' != ' . (int)$this->id);
+
+ $db->setQuery($query);
+ $result = $db->loadResult();
+
+ if ((boolean)$result) {
+ $this->setError(JText::_('COM_REDSHOP_FIELDS_ALLREADY_EXIST'));
+
+ return false;
+ }
+
+ if (!$this->id) {
+ $query = $db->getQuery(true)
+ ->select('COUNT(*) + 1')
+ ->from($db->qn('#__redshop_fields'));
+
+ $this->ordering = (int)$db->setQuery($query)->loadResult();
+ }
+
+ return true;
+ }
+
+ /**
+ * Do the database store.
+ *
+ * @param boolean $updateNulls True to update null values as well.
+ *
+ * @return boolean
+ * @throws Exception
+ */
+ protected function doStore($updateNulls = false)
+ {
+ if (!$this->groupId) {
+ $this->groupId = null;
+ }
+
+ if (!parent::doStore($updateNulls)) {
+ return false;
+ }
+
+ if ($this->type == 0 || $this->type == RedshopHelperExtrafields::TYPE_TEXT || $this->type == RedshopHelperExtrafields::TYPE_TEXT_AREA) {
+ $id[] = (int)$this->id;
+ $this->deleteFieldValues($id, 'field_id');
+ } else {
+ $this->saveFieldValues($this->id);
+ }
+
+ return true;
+ }
+
+ /**
+ * Method to delete all values related to a field or array of fields
+ *
+ * @param array $ids An array of field ids.
+ * @param string $field The field column to check for deleting.
+ *
+ * @return boolean True if successful, false if an error occurs.
+ *
+ * @since 2.0.6
+ */
+ protected function deleteFieldValues($ids, $field)
+ {
+ $db = $this->getDbo();
+ $ids = implode(',', $ids);
+
+ $query = $db->getQuery(true)
+ ->delete($db->qn('#__redshop_fields_value'))
+ ->where($db->qn($field) . ' IN (' . $ids . ')');
+
+ if (!$db->setQuery($query)->execute()) {
+ $this->setError($db->getErrorMsg());
+
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Method to save all values related to a field
+ *
+ * @param int $id Id of field.
+ *
+ * @return boolean True if successful, false if an error occurs.
+ * @throws Exception
+ *
+ * @since 2.0.6
+ */
+ protected function saveFieldValues($id)
+ {
+ $db = JFactory::getDbo();
+ $valueIds = array();
+ $extraNames = array();
+ $extraValues = array();
+
+ // Get input
+ $app = JFactory::getApplication();
+ $post = $app->input->post;
+ $total = 0;
+
+ if (is_array($post->get('value_id'))) {
+ $extraValues = $post->getString('extra_value', '');
+ $valueIds = $post->get('value_id', array(), 'array');
+
+ if ($this->type == RedshopHelperExtrafields::TYPE_IMAGE_SELECT || $this->type == RedshopHelperExtrafields::TYPE_IMAGE_WITH_LINK) {
+ $extraNames = JFactory::getApplication()->input->files->get('extra_name_file', array(), 'array');
+ $total = count((array)$extraNames);
+ } else {
+ $extraNames = $post->get('extra_name', '', 'raw');
+ $total = count((array)$extraNames);
+ }
+ }
+
+ // Do not reset values if we are ordering
+ $task = $app->input->get('task');
+
+ if ($task != 'fields.saveOrderAjax' && $task != 'saveOrderAjax') {
+ $fieldDataIds = RedshopEntityField::getInstance($id)->getFieldValues();
+
+ if (count($fieldDataIds) > 0) {
+ $fid = array();
+
+ foreach ($fieldDataIds as $fieldDataId) {
+ $fid[] = $fieldDataId->value_id;
+ }
+
+ $delFieldIds = array_diff($fid, $valueIds);
+
+ if (count($delFieldIds) > 0) {
+ $this->deleteFieldValues($delFieldIds, 'value_id');
+ }
+ }
+ }
+
+ for ($j = 0; $j < $total; $j++) {
+ $filename = $extraNames[$j];
+
+ if ($this->type == RedshopHelperExtrafields::TYPE_IMAGE_SELECT || $this->type == RedshopHelperExtrafields::TYPE_IMAGE_WITH_LINK) {
+ if ($extraValues[$j] != "" && $extraNames[$j]['name'] != "" && $extraNames[$j]['error'] == 0) {
+ $filename = RedshopHelperMedia::cleanFileName($extraNames[$j]['name']);
+
+ $source = $extraNames[$j]['tmp_name'];
+ $destination = REDSHOP_FRONT_IMAGES_RELPATH . 'extrafield/' . $filename;
+
+ JFile::upload($source, $destination);
+ }
+ }
+
+ if ($extraNames[$j]['error'] == 0 || !isset($extraNames[$j]['error'])) {
+ if (empty($valueIds[$j])) {
+ $obj = new stdClass;
+ $obj->field_id = (int)$id;
+ $obj->field_name = $filename;
+ $obj->field_value = $extraValues[$j];
+ $db->insertObject('#__redshop_fields_value', $obj);
+ } else {
+ $obj = new stdClass;
+ $obj->value_id = $valueIds[$j];
+ $obj->field_value = $extraValues[$j];
+ $obj->field_name = $filename;
+ $db->updateObject('#__redshop_fields_value', $obj, array('value_id'));
+ }
+ } else {
+ $obj = new stdClass;
+ $obj->value_id = $valueIds[$j];
+ $obj->field_value = $extraValues[$j];
+ $obj->field_name = $filename;
+ $db->updateObject('#__redshop_fields_value', $obj, array('value_id'));
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Delete one or more registers
+ *
+ * @param mixed $pk Array of ids or ids comma separated
+ *
+ * @return boolean Deleted successfully?
+ */
+ protected function doDelete($pk = null)
+ {
+ $db = $this->getDbo();
+
+ if (!parent::doDelete($pk)) {
+ return false;
+ }
+
+ if (is_array($pk)) {
+ $pk = implode(',', $pk);
+ }
+
+ // Remove fields_data
+ $query = $db->getQuery(true)
+ ->delete($db->qn('#__redshop_fields_data'))
+ ->where($db->qn('fieldid') . ' IN (' . $pk . ')');
+
+ $db->setQuery($query);
+
+ if (!$db->execute()) {
+ $this->setError($db->getErrorMsg());
+ }
+
+ return true;
+ }
}
diff --git a/component/admin/tables/field_data.php b/component/admin/tables/field_data.php
index 668d3653b78..0061e3f433e 100644
--- a/component/admin/tables/field_data.php
+++ b/component/admin/tables/field_data.php
@@ -18,17 +18,17 @@
*/
class RedshopTableField_Data extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_fields_data';
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_fields_data';
- /**
- * The table key column. Usually: id
- *
- * @var string
- */
- protected $_tableKey = 'data_id';
+ /**
+ * The table key column. Usually: id
+ *
+ * @var string
+ */
+ protected $_tableKey = 'data_id';
}
diff --git a/component/admin/tables/field_group.php b/component/admin/tables/field_group.php
index 863b06a5313..7f73b9ba24f 100644
--- a/component/admin/tables/field_group.php
+++ b/component/admin/tables/field_group.php
@@ -18,128 +18,115 @@
*/
class RedshopTableField_Group extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- *
- * @since 2.1.0
- */
- protected $_tableName = 'redshop_fields_group';
-
- /**
- * @var integer
- *
- * @since 2.1.0
- */
- public $id = null;
-
- /**
- * @var string
- *
- * @since 2.1.0
- */
- public $name = null;
-
- /**
- * @var string
- *
- * @since 2.1.0
- */
- public $description = null;
-
- /**
- * @var string
- *
- * @since 2.1.0
- */
- public $section = null;
-
- /**
- * @var integer
- *
- * @since 2.1.0
- */
- public $created_by = null;
-
- /**
- * @var string
- *
- * @since 2.1.0
- */
- public $created_date = null;
-
- /**
- * @var integer
- *
- * @since 2.1.0
- */
- public $checked_out = null;
-
- /**
- * @var string
- *
- * @since 2.1.0
- */
- public $checked_out_time;
-
- /**
- * @var string
- *
- * @since 2.1.0
- */
- public $modified_date = null;
-
- /**
- * @var integer
- *
- * @since 2.1.0
- */
- public $modified_by = null;
-
- /**
- * @var integer
- *
- * @since 2.1.0
- */
- public $ordering = null;
-
- /**
- * @var integer
- *
- * @since 2.1.0
- */
- public $published = null;
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (!parent::doCheck())
- {
- return false;
- }
-
- if (empty($this->name))
- {
- /** @scrutinizer ignore-deprecated */ $this->setError('COM_REDSHOP_FIELD_GROUP_ERROR_MISSING_NAME');
-
- return false;
- }
-
- if (empty($this->section))
- {
- /** @scrutinizer ignore-deprecated */ $this->setError('COM_REDSHOP_FIELD_GROUP_ERROR_MISSING_SECTION');
-
- return false;
- }
-
- return true;
- }
+ /**
+ * @var integer
+ *
+ * @since 2.1.0
+ */
+ public $id = null;
+ /**
+ * @var string
+ *
+ * @since 2.1.0
+ */
+ public $name = null;
+ /**
+ * @var string
+ *
+ * @since 2.1.0
+ */
+ public $description = null;
+ /**
+ * @var string
+ *
+ * @since 2.1.0
+ */
+ public $section = null;
+ /**
+ * @var integer
+ *
+ * @since 2.1.0
+ */
+ public $created_by = null;
+ /**
+ * @var string
+ *
+ * @since 2.1.0
+ */
+ public $created_date = null;
+ /**
+ * @var integer
+ *
+ * @since 2.1.0
+ */
+ public $checked_out = null;
+ /**
+ * @var string
+ *
+ * @since 2.1.0
+ */
+ public $checked_out_time;
+ /**
+ * @var string
+ *
+ * @since 2.1.0
+ */
+ public $modified_date = null;
+ /**
+ * @var integer
+ *
+ * @since 2.1.0
+ */
+ public $modified_by = null;
+ /**
+ * @var integer
+ *
+ * @since 2.1.0
+ */
+ public $ordering = null;
+ /**
+ * @var integer
+ *
+ * @since 2.1.0
+ */
+ public $published = null;
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ *
+ * @since 2.1.0
+ */
+ protected $_tableName = 'redshop_fields_group';
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (!parent::doCheck()) {
+ return false;
+ }
+
+ if (empty($this->name)) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError('COM_REDSHOP_FIELD_GROUP_ERROR_MISSING_NAME');
+
+ return false;
+ }
+
+ if (empty($this->section)) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError('COM_REDSHOP_FIELD_GROUP_ERROR_MISSING_SECTION');
+
+ return false;
+ }
+
+ return true;
+ }
}
diff --git a/component/admin/tables/fields_value.php b/component/admin/tables/fields_value.php
index ec4b7086202..5931c8d4dfb 100644
--- a/component/admin/tables/fields_value.php
+++ b/component/admin/tables/fields_value.php
@@ -11,30 +11,29 @@
class Tablefields_value extends JTable
{
- public $value_id = null;
+ public $value_id = null;
- public $field_id = null;
+ public $field_id = null;
- public $field_name = null;
+ public $field_name = null;
- public $field_value = null;
+ public $field_value = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'fields_value', 'value_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'fields_value', 'value_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/giftcard.php b/component/admin/tables/giftcard.php
index 22f0d1875d6..6011e2abfee 100644
--- a/component/admin/tables/giftcard.php
+++ b/component/admin/tables/giftcard.php
@@ -20,142 +20,131 @@
*/
class RedshopTableGiftcard extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_giftcard';
-
- /**
- * The table key column. Usually: id
- *
- * @var string
- */
- protected $_tableKey = 'giftcard_id';
-
- /**
- * Delete one or more registers
- *
- * @param string/array $pk Array of ids or ids comma separated
- *
- * @return boolean Deleted successfuly?
- */
- protected function doDelete($pk = null)
- {
- if ($this->giftcard_image != '' && file(REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $this->giftcard_image))
- {
- JFile::delete(REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $this->giftcard_image);
- }
-
- if ($this->giftcard_bgimage != '' && file(REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $this->giftcard_bgimage))
- {
- JFile::delete(REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $this->giftcard_bgimage);
- }
-
- return parent::doDelete($pk);
- }
-
- /**
- * Do the database store.
- *
- * @param boolean $updateNulls True to update null values as well.
- *
- * @return boolean
- */
- protected function doStore($updateNulls = false)
- {
-
- // Get input
- $app = JFactory::getApplication();
- $input = $app->input;
-
- $giftCardFile = $input->files->get('jform');
- $image = $giftCardFile['giftcard_image_file'];
-
- if ($image['name'] != '' && $this->giftcard_image != '')
- {
- JFile::delete(REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $this->giftcard_image);
- $this->giftcard_image = '';
- }
-
- if ($image['name'] != '')
- {
- $image['name'] = RedshopHelperMedia::cleanFileName($image['name']);
- $this->giftcard_image = $image['name'];
- JFile::upload($image['tmp_name'], REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $image['name']);
- }
-
- // Get background image file
- $bgImage = $giftCardFile['giftcard_bgimage_file'];
-
- if (($bgImage['name'] != '' && $this->giftcard_bgimage != ''))
- {
- JFile::delete(REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $this->giftcard_bgimage);
- $this->giftcard_bgimage = '';
- }
-
- if ($bgImage['name'] != '')
- {
- $bgImage['name'] = RedshopHelperMedia::cleanFileName($bgImage['name']);
- $this->giftcard_bgimage = $bgImage['name'];
- JFile::upload($bgImage['tmp_name'], REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $bgImage['name']);
- }
-
- $this->giftcard_price = RedshopHelperProduct::redpriceDecimal($this->giftcard_price);
- $this->giftcard_value = RedshopHelperProduct::redpriceDecimal($this->giftcard_value);
-
- if (!parent::doStore($updateNulls))
- {
- return false;
- }
-
- if (Redshop::getConfig()->get('ECONOMIC_INTEGRATION') == 1)
- {
- $giftData = new stdClass;
- $giftData->product_id = $this->giftcard_id;
- $giftData->product_number = "gift_" . $this->giftcard_id . "_" . $this->giftcard_name;
- $giftData->product_name = $this->giftcard_name;
- $giftData->product_price = $this->giftcard_price;
- $giftData->accountgroup_id = $this->accountgroup_id;
- $giftData->product_volume = 0;
-
- RedshopEconomic::createProductInEconomic($giftData);
- }
-
- return true;
- }
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (empty($this->giftcard_name))
- {
- return false;
- }
-
- if (empty($this->giftcard_price))
- {
- return false;
- }
-
- if (empty($this->giftcard_value))
- {
- return false;
- }
-
- if (empty($this->giftcard_validity))
- {
- return false;
- }
-
- return parent::doCheck();
- }
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_giftcard';
+
+ /**
+ * The table key column. Usually: id
+ *
+ * @var string
+ */
+ protected $_tableKey = 'giftcard_id';
+
+ /**
+ * Delete one or more registers
+ *
+ * @param string/array $pk Array of ids or ids comma separated
+ *
+ * @return boolean Deleted successfuly?
+ */
+ protected function doDelete($pk = null)
+ {
+ if ($this->giftcard_image != '' && file(REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $this->giftcard_image)) {
+ JFile::delete(REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $this->giftcard_image);
+ }
+
+ if ($this->giftcard_bgimage != '' && file(
+ REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $this->giftcard_bgimage
+ )) {
+ JFile::delete(REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $this->giftcard_bgimage);
+ }
+
+ return parent::doDelete($pk);
+ }
+
+ /**
+ * Do the database store.
+ *
+ * @param boolean $updateNulls True to update null values as well.
+ *
+ * @return boolean
+ */
+ protected function doStore($updateNulls = false)
+ {
+ // Get input
+ $app = JFactory::getApplication();
+ $input = $app->input;
+
+ $giftCardFile = $input->files->get('jform');
+ $image = $giftCardFile['giftcard_image_file'];
+
+ if ($image['name'] != '' && $this->giftcard_image != '') {
+ JFile::delete(REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $this->giftcard_image);
+ $this->giftcard_image = '';
+ }
+
+ if ($image['name'] != '') {
+ $image['name'] = RedshopHelperMedia::cleanFileName($image['name']);
+ $this->giftcard_image = $image['name'];
+ JFile::upload($image['tmp_name'], REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $image['name']);
+ }
+
+ // Get background image file
+ $bgImage = $giftCardFile['giftcard_bgimage_file'];
+
+ if (($bgImage['name'] != '' && $this->giftcard_bgimage != '')) {
+ JFile::delete(REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $this->giftcard_bgimage);
+ $this->giftcard_bgimage = '';
+ }
+
+ if ($bgImage['name'] != '') {
+ $bgImage['name'] = RedshopHelperMedia::cleanFileName($bgImage['name']);
+ $this->giftcard_bgimage = $bgImage['name'];
+ JFile::upload($bgImage['tmp_name'], REDSHOP_FRONT_IMAGES_RELPATH . 'giftcard/' . $bgImage['name']);
+ }
+
+ $this->giftcard_price = RedshopHelperProduct::redpriceDecimal($this->giftcard_price);
+ $this->giftcard_value = RedshopHelperProduct::redpriceDecimal($this->giftcard_value);
+
+ if (!parent::doStore($updateNulls)) {
+ return false;
+ }
+
+ if (Redshop::getConfig()->get('ECONOMIC_INTEGRATION') == 1) {
+ $giftData = new stdClass;
+ $giftData->product_id = $this->giftcard_id;
+ $giftData->product_number = "gift_" . $this->giftcard_id . "_" . $this->giftcard_name;
+ $giftData->product_name = $this->giftcard_name;
+ $giftData->product_price = $this->giftcard_price;
+ $giftData->accountgroup_id = $this->accountgroup_id;
+ $giftData->product_volume = 0;
+
+ RedshopEconomic::createProductInEconomic($giftData);
+ }
+
+ return true;
+ }
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (empty($this->giftcard_name)) {
+ return false;
+ }
+
+ if (empty($this->giftcard_price)) {
+ return false;
+ }
+
+ if (empty($this->giftcard_value)) {
+ return false;
+ }
+
+ if (empty($this->giftcard_validity)) {
+ return false;
+ }
+
+ return parent::doCheck();
+ }
}
diff --git a/component/admin/tables/index.html b/component/admin/tables/index.html
index fa6d84e8055..1cbdf58d903 100644
--- a/component/admin/tables/index.html
+++ b/component/admin/tables/index.html
@@ -1 +1,3 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/component/admin/tables/mail.php b/component/admin/tables/mail.php
index b22564a9c88..15fd645419e 100644
--- a/component/admin/tables/mail.php
+++ b/component/admin/tables/mail.php
@@ -18,45 +18,42 @@
*/
class RedshopTableMail extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_mail';
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_mail';
- /**
- * The table key column. Usually: id
- *
- * @var string
- */
- protected $_tableKey = 'mail_id';
+ /**
+ * The table key column. Usually: id
+ *
+ * @var string
+ */
+ protected $_tableKey = 'mail_id';
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (empty($this->mail_name))
- {
- return false;
- }
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (empty($this->mail_name)) {
+ return false;
+ }
- if (empty($this->mail_section))
- {
- return false;
- }
+ if (empty($this->mail_section)) {
+ return false;
+ }
- if (empty($this->mail_subject))
- {
- return false;
- }
+ if (empty($this->mail_subject)) {
+ return false;
+ }
- return parent::doCheck();
- }
+ return parent::doCheck();
+ }
}
diff --git a/component/admin/tables/manufacturer.php b/component/admin/tables/manufacturer.php
index 8f95bb02c95..bb90080912a 100644
--- a/component/admin/tables/manufacturer.php
+++ b/component/admin/tables/manufacturer.php
@@ -18,237 +18,223 @@
*/
class RedshopTableManufacturer extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_manufacturer';
-
- /**
- * @var integer
- */
- public $id;
-
- /**
- * @var string
- */
- public $name;
-
- /**
- * @var integer
- */
- public $published = 1;
-
- /**
- * @var integer
- */
- public $product_per_page;
-
- /**
- * Delete one or more registers
- *
- * @param string/array $pk Array of ids or ids comma separated
- *
- * @return boolean Deleted successfully?
- */
- protected function doDelete($pk = null)
- {
- $manufacturerId = $this->id;
- $media = RedshopEntityManufacturer::getInstance($manufacturerId)->getMedia();
-
- if (!parent::doDelete($pk))
- {
- return false;
- }
-
- // B/C for old plugin
- JPluginHelper::importPlugin('redshop_product');
- RedshopHelperUtility::getDispatcher()->trigger('onAfterManufacturerDelete', array($manufacturerId));
-
- // Delete associated media
- if ($media->isValid())
- {
- /** @var RedshopTableMedia $mediaTable */
- $mediaTable = RedshopTable::getInstance('Media', 'RedshopTable');
-
- if ($mediaTable->load($media->get('media_id')))
- {
- $mediaTable->delete();
- }
- }
-
- // Delete media folder
- JFolder::delete(REDSHOP_MEDIA_IMAGE_RELPATH . 'manufacturer/' . $manufacturerId);
-
- return true;
- }
-
- /**
- * Do the database store.
- *
- * @param boolean $updateNulls True to update null values as well.
- *
- * @return boolean
- * @throws Exception
- * @since 2.1.0
- */
- protected function doStore($updateNulls = false)
- {
- JPluginHelper::importPlugin('redshop_product');
-
- // B/C for old plugin
- $isNew = $this->id > 0 ? false : true;
- RedshopHelperUtility::getDispatcher()->trigger('onBeforeManufacturerSave', array(&$this, $isNew));
-
- if (!parent::doStore($updateNulls))
- {
- return false;
- }
-
- // Store fields data.
- $this->storeFields();
-
- // Store media
- $this->storeMedia();
-
- // B/C for old plugin
- RedshopHelperUtility::getDispatcher()->trigger('onAfterManufacturerSave', array(&$this, $isNew));
-
- return true;
- }
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (!parent::doCheck())
- {
- return false;
- }
-
- // Check product per page
- if (!$this->product_per_page)
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_MANUFACTURER_ERROR_PRODUCT_PER_PAGE'));
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Method for store fields data.
- *
- * @return void
- * @throws Exception
- *
- * @since 2.1.0
- */
- protected function storeFields()
- {
- RedshopHelperExtrafields::extraFieldSave(
- JFactory::getApplication()->input->post->getArray(), RedshopHelperExtrafields::SECTION_MANUFACTURER, $this->id
- );
- }
-
- /**
- * Method for store fields data.
- *
- * @return void
- * @throws Exception
- *
- * @since 2.1.0
- */
- protected function storeMedia()
- {
- $mediaField = 'manufacturer_image';
-
- // Prepare target folder.
- \Redshop\Helper\Media::createFolder(REDSHOP_MEDIA_IMAGE_RELPATH . 'manufacturer/' . $this->id);
-
- // Prepare target folder.
- \Redshop\Helper\Media::createFolder(REDSHOP_MEDIA_IMAGE_RELPATH . 'manufacturer/' . $this->id . '/thumb');
-
- $input = JFactory::getApplication()->input;
-
- $dropzone = $input->post->get('dropzone', array(), '');
- $dropzone = isset($dropzone[$mediaField]) ? $dropzone[$mediaField] : null;
-
- $dropzoneAlternateText = $input->post->get('dropzone_alternate_text', array(), '');
- $dropzoneAlternateText = isset($dropzoneAlternateText[$mediaField]) ? $dropzoneAlternateText[$mediaField] : null;
-
- if (null === $dropzone)
- {
- return;
- }
-
- foreach ($dropzone as $key => $value)
- {
- /** @var RedshopTableMedia $mediaTable */
- $mediaTable = JTable::getInstance('Media', 'RedshopTable');
-
- if (strpos($key, 'media-') !== false)
- {
- $mediaTable->load(str_replace('media-', '', $key));
-
- // Delete old image.
- $oldMediaFile = JPath::clean(REDSHOP_MEDIA_IMAGE_RELPATH . 'manufacturer/'
- . $this->id . '/' . $mediaTable->media_name
- );
-
- if (JFile::exists($oldMediaFile))
- {
- JFile::delete($oldMediaFile);
- }
-
- if (empty($value))
- {
- $mediaTable->delete();
-
- continue;
- }
- }
- else
- {
- $mediaTable->set('section_id', $this->id);
- $mediaTable->set('media_section', 'manufacturer');
- }
-
- if (!JFile::exists(JPATH_ROOT . '/' . $value))
- {
- continue;
- }
-
- $alternateText = isset($dropzoneAlternateText[$key]) ? $dropzoneAlternateText[$key] : $this->name;
-
- $mediaTable->set('media_alternate_text', $alternateText);
- $mediaTable->set('media_type', 'images');
- $mediaTable->set('published', 1);
-
- // Copy new image for this media
- $fileName = md5($this->name) . '.' . JFile::getExt($value);
- $file = REDSHOP_MEDIA_IMAGE_RELPATH . 'manufacturer/' . $this->id . '/' . $fileName;
-
- JFile::move(JPATH_ROOT . '/' . $value, $file);
-
- $mediaTable->set('media_name', $fileName);
- $mediaTable->store();
-
- // Optimize image
- $factory = new \ImageOptimizer\OptimizerFactory;
- $optimizer = $factory->get();
- $optimizer->optimize($file);
- }
-
- // Clear thumbnail folder
- \Redshop\Helper\Media::createFolder(REDSHOP_MEDIA_IMAGE_RELPATH . 'manufacturer/' . $this->id . '/thumb', true);
- }
+ /**
+ * @var integer
+ */
+ public $id;
+ /**
+ * @var string
+ */
+ public $name;
+ /**
+ * @var integer
+ */
+ public $published = 1;
+ /**
+ * @var integer
+ */
+ public $product_per_page;
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_manufacturer';
+
+ /**
+ * Delete one or more registers
+ *
+ * @param string/array $pk Array of ids or ids comma separated
+ *
+ * @return boolean Deleted successfully?
+ */
+ protected function doDelete($pk = null)
+ {
+ $manufacturerId = $this->id;
+ $media = RedshopEntityManufacturer::getInstance($manufacturerId)->getMedia();
+
+ if (!parent::doDelete($pk)) {
+ return false;
+ }
+
+ // B/C for old plugin
+ JPluginHelper::importPlugin('redshop_product');
+ RedshopHelperUtility::getDispatcher()->trigger('onAfterManufacturerDelete', array($manufacturerId));
+
+ // Delete associated media
+ if ($media->isValid()) {
+ /** @var RedshopTableMedia $mediaTable */
+ $mediaTable = RedshopTable::getInstance('Media', 'RedshopTable');
+
+ if ($mediaTable->load($media->get('media_id'))) {
+ $mediaTable->delete();
+ }
+ }
+
+ // Delete media folder
+ JFolder::delete(REDSHOP_MEDIA_IMAGE_RELPATH . 'manufacturer/' . $manufacturerId);
+
+ return true;
+ }
+
+ /**
+ * Do the database store.
+ *
+ * @param boolean $updateNulls True to update null values as well.
+ *
+ * @return boolean
+ * @throws Exception
+ * @since 2.1.0
+ */
+ protected function doStore($updateNulls = false)
+ {
+ JPluginHelper::importPlugin('redshop_product');
+
+ // B/C for old plugin
+ $isNew = $this->id > 0 ? false : true;
+ RedshopHelperUtility::getDispatcher()->trigger('onBeforeManufacturerSave', array(&$this, $isNew));
+
+ if (!parent::doStore($updateNulls)) {
+ return false;
+ }
+
+ // Store fields data.
+ $this->storeFields();
+
+ // Store media
+ $this->storeMedia();
+
+ // B/C for old plugin
+ RedshopHelperUtility::getDispatcher()->trigger('onAfterManufacturerSave', array(&$this, $isNew));
+
+ return true;
+ }
+
+ /**
+ * Method for store fields data.
+ *
+ * @return void
+ * @throws Exception
+ *
+ * @since 2.1.0
+ */
+ protected function storeFields()
+ {
+ RedshopHelperExtrafields::extraFieldSave(
+ JFactory::getApplication()->input->post->getArray(),
+ RedshopHelperExtrafields::SECTION_MANUFACTURER,
+ $this->id
+ );
+ }
+
+ /**
+ * Method for store fields data.
+ *
+ * @return void
+ * @throws Exception
+ *
+ * @since 2.1.0
+ */
+ protected function storeMedia()
+ {
+ $mediaField = 'manufacturer_image';
+
+ // Prepare target folder.
+ \Redshop\Helper\Media::createFolder(REDSHOP_MEDIA_IMAGE_RELPATH . 'manufacturer/' . $this->id);
+
+ // Prepare target folder.
+ \Redshop\Helper\Media::createFolder(REDSHOP_MEDIA_IMAGE_RELPATH . 'manufacturer/' . $this->id . '/thumb');
+
+ $input = JFactory::getApplication()->input;
+
+ $dropzone = $input->post->get('dropzone', array(), '');
+ $dropzone = isset($dropzone[$mediaField]) ? $dropzone[$mediaField] : null;
+
+ $dropzoneAlternateText = $input->post->get('dropzone_alternate_text', array(), '');
+ $dropzoneAlternateText = isset($dropzoneAlternateText[$mediaField]) ? $dropzoneAlternateText[$mediaField] : null;
+
+ if (null === $dropzone) {
+ return;
+ }
+
+ foreach ($dropzone as $key => $value) {
+ /** @var RedshopTableMedia $mediaTable */
+ $mediaTable = JTable::getInstance('Media', 'RedshopTable');
+
+ if (strpos($key, 'media-') !== false) {
+ $mediaTable->load(str_replace('media-', '', $key));
+
+ // Delete old image.
+ $oldMediaFile = JPath::clean(
+ REDSHOP_MEDIA_IMAGE_RELPATH . 'manufacturer/'
+ . $this->id . '/' . $mediaTable->media_name
+ );
+
+ if (JFile::exists($oldMediaFile)) {
+ JFile::delete($oldMediaFile);
+ }
+
+ if (empty($value)) {
+ $mediaTable->delete();
+
+ continue;
+ }
+ } else {
+ $mediaTable->set('section_id', $this->id);
+ $mediaTable->set('media_section', 'manufacturer');
+ }
+
+ if (!JFile::exists(JPATH_ROOT . '/' . $value)) {
+ continue;
+ }
+
+ $alternateText = isset($dropzoneAlternateText[$key]) ? $dropzoneAlternateText[$key] : $this->name;
+
+ $mediaTable->set('media_alternate_text', $alternateText);
+ $mediaTable->set('media_type', 'images');
+ $mediaTable->set('published', 1);
+
+ // Copy new image for this media
+ $fileName = md5($this->name) . '.' . JFile::getExt($value);
+ $file = REDSHOP_MEDIA_IMAGE_RELPATH . 'manufacturer/' . $this->id . '/' . $fileName;
+
+ JFile::move(JPATH_ROOT . '/' . $value, $file);
+
+ $mediaTable->set('media_name', $fileName);
+ $mediaTable->store();
+
+ // Optimize image
+ $factory = new \ImageOptimizer\OptimizerFactory;
+ $optimizer = $factory->get();
+ $optimizer->optimize($file);
+ }
+
+ // Clear thumbnail folder
+ \Redshop\Helper\Media::createFolder(REDSHOP_MEDIA_IMAGE_RELPATH . 'manufacturer/' . $this->id . '/thumb', true);
+ }
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (!parent::doCheck()) {
+ return false;
+ }
+
+ // Check product per page
+ if (!$this->product_per_page) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_MANUFACTURER_ERROR_PRODUCT_PER_PAGE'));
+
+ return false;
+ }
+
+ return true;
+ }
}
diff --git a/component/admin/tables/mass_discount.php b/component/admin/tables/mass_discount.php
index ce86b382ff5..9c069c76a86 100644
--- a/component/admin/tables/mass_discount.php
+++ b/component/admin/tables/mass_discount.php
@@ -20,636 +20,575 @@
*/
class RedshopTableMass_Discount extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_mass_discount';
-
- /**
- * @var string
- */
- public $end_date;
-
- /**
- * @var integer
- */
- public $amount;
-
- /**
- * @var integer
- */
- public $type;
-
- /**
- * Called before bind().
- *
- * Method to bind an associative array or object to the JTable instance.This
- * method only binds properties that are publicly accessible and optionally
- * takes an array of properties to ignore when binding.
- *
- * @param mixed $src An associative array or object to bind to the JTable instance.
- * @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
- *
- * @return boolean True on success.
- */
- public function beforeBind(&$src, $ignore = array())
- {
- // Bind: Start Date unix
- if (isset($src['start_date']) && !empty($src['start_date']) && !is_numeric($src['start_date']))
- {
- $date = JFactory::getDate($src['start_date']);
- $src['start_date'] = $date->toUnix();
- }
-
- // Bind: End Date unix
- if (isset($src['end_date']) && !empty($src['end_date']) && !is_numeric($src['end_date']))
- {
- $date = JFactory::getDate($src['end_date']);
- $src['end_date'] = $date->toUnix();
- }
-
- // Bind: Discount products
- if (isset($src['discount_product']) && !empty($src['discount_product']) && is_array($src['discount_product']))
- {
- $src['discount_product'] = ArrayHelper::toInteger($src['discount_product']);
- $src['discount_product'] = array_unique(array_filter($src['discount_product']));
- $src['discount_product'] = implode(',', $src['discount_product']);
- }
-
- // Bind: Categories
- if (isset($src['category_id']) && !empty($src['category_id']) && is_array($src['category_id']))
- {
- $src['category_id'] = ArrayHelper::toInteger($src['category_id']);
- $src['category_id'] = array_unique(array_filter($src['category_id']));
- $src['category_id'] = implode(',', $src['category_id']);
- }
-
- // Bind: Manufacturers
- if (isset($src['manufacturer_id']) && !empty($src['manufacturer_id']) && is_array($src['manufacturer_id']))
- {
- $src['manufacturer_id'] = ArrayHelper::toInteger($src['manufacturer_id']);
- $src['manufacturer_id'] = array_unique(array_filter($src['manufacturer_id']));
- $src['manufacturer_id'] = implode(',', $src['manufacturer_id']);
- }
-
- return parent::beforeBind($src, $ignore);
- }
-
- /**
- * Method to bind an associative array or object to the JTable instance.This
- * method only binds properties that are publicly accessible and optionally
- * takes an array of properties to ignore when binding.
- *
- * @param mixed $src An associative array or object to bind to the JTable instance.
- * @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
- *
- * @return boolean True on success.
- *
- * @throws \InvalidArgumentException
- */
- protected function doBind(&$src, $ignore = array())
- {
- if (empty($src['discount_product']) && empty($this->discount_product))
- {
- $this->discount_product = null;
- unset($src['discount_product']);
- }
-
- if (empty($src['category_id']) && empty($this->category_id))
- {
- $this->category_id = null;
- unset($src['category_id']);
- }
-
- return parent::doBind($src, $ignore);
- }
-
- /**
- * Delete one or more registers
- *
- * @param string|array $pk Array of ids or ids comma separated
- *
- * @return boolean Deleted successfuly?
- */
- protected function doDelete($pk = null)
- {
- $massDiscountIds = $pk;
-
- if (!is_array($massDiscountIds))
- {
- $massDiscountIds = array($massDiscountIds);
- }
-
- $massDiscountIds = ArrayHelper::toInteger($massDiscountIds);
- $productIds = array();
-
- $table = clone $this;
-
- foreach ($massDiscountIds as $massDiscountId)
- {
- if (!$table->load($massDiscountId))
- {
- continue;
- }
-
- if (!empty($table->get('discount_product')))
- {
- $this->updateProduct($table->get('discount_product'));
- }
-
- $categories = explode(',', $table->category_id);
- $categories = array_filter(ArrayHelper::toInteger($categories));
-
- foreach ($categories as $category)
- {
- $products = RedshopHelperProduct::getProductCategory($category);
-
- if (empty($products))
- {
- continue;
- }
-
- foreach ($products as $product)
- {
- $productIds[] = $product->product_id;
- }
- }
-
- $manufacturers = explode(',', $table->manufacturer_id);
- $manufacturers = array_filter(ArrayHelper::toInteger($manufacturers));
-
- foreach ($manufacturers as $manufacturer)
- {
- $products = $this->getProductsFromManufacturer($manufacturer);
-
- if (empty($products))
- {
- continue;
- }
-
- foreach ($products as $product)
- {
- $productIds[] = $product->product_id;
- }
- }
- }
-
- if (!empty($productIds))
- {
- $this->updateProduct($productIds);
- }
-
- return parent::doDelete($pk);
- }
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass
- * @throws Exception
- */
- protected function doCheck()
- {
- if (!parent::doCheck())
- {
- return false;
- }
-
- if (empty($this->name))
- {
- /** @scrutinizer ignore-deprecated */ $this->/** @scrutinizer ignore-call */
- setError(JText::_('COM_REDSHOP_MASS_DISCOUNT_MISSING_DISCOUNT_NAME'), 'error');
-
- return false;
- }
-
- if (empty($this->amount))
- {
- /** @scrutinizer ignore-deprecated */ $this->/** @scrutinizer ignore-call */ setError(JText::_('COM_REDSHOP_MASS_DISCOUNT_DISCOUNT_AMOUNT_MUST_BE_LARGER_THAN_ZERO'), 'error');
-
- return false;
- }
-
- if (empty($this->discount_product) && empty($this->category_id) && empty($this->manufacturer_id))
- {
- /** @scrutinizer ignore-deprecated */ $this->/** @scrutinizer ignore-call */ setError(JText::_('COM_REDSHOP_MASS_DISCOUNT_DETAIL_NO_PRODUCTS_SELECTED'), 'error');
-
- return false;
- }
-
- if ($this->start_date > $this->end_date)
- {
- /** @scrutinizer ignore-deprecated */ $this->/** @scrutinizer ignore-call */ setError(JText::_('COM_REDSHOP_MASS_DISCOUNT_ENDDATE_LOWER_STARTDATE'), 'error');
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Called before store(). Overriden to send isNew to plugins.
- *
- * @param boolean $updateNulls True to update null values as well.
- * @param boolean $isNew True if we are adding a new item.
- * @param mixed $oldItem null for new items | JTable otherwise
- *
- * @return boolean True on success.
- * @throws Exception
- */
- protected function beforeStore($updateNulls = false, $isNew = false, $oldItem = null)
- {
- if (!parent::beforeStore($updateNulls, $isNew, $oldItem))
- {
- return false;
- }
-
- $db = $this->_db;
- $query = $db->getQuery(true);
-
- $this->updateProductsBaseDiscountProduct($this, $isNew, $oldItem);
-
- /*
- * Update products for "category_id"
- */
- $categories = $isNew ? array() : explode(',', $oldItem->category_id);
- $newCategories = explode(',', $this->category_id);
- $isChangeCategory = false;
- $isNewChangeCategory = false;
-
- $diffCategories = array_diff($categories, $newCategories);
-
- if (count($diffCategories))
- {
- sort($diffCategories);
- }
- else
- {
- $isChangeCategory = true;
- }
-
- $diffCategories = array_filter(array_values($diffCategories));
-
- foreach ($diffCategories as $diffCategory)
- {
- $products = RedshopHelperProduct::getProductCategory($diffCategory);
- $productIds = array();
-
- foreach ($products as $product)
- {
- $productIds[] = $product->product_id;
- }
-
- if (empty($productIds))
- {
- continue;
- }
-
- $query->clear()
- ->update($db->qn('#__redshop_product'))
- ->set($db->qn('product_on_sale') . ' = 0')
- ->where($db->qn('product_id') . ' IN (' . implode(',', $productIds) . ')');
-
- if (!$db->setQuery($query)->execute())
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(/** @scrutinizer ignore-deprecated */ $db->getErrorMsg());
-
- return false;
- }
- }
-
- $newDiffCategories = array_diff($newCategories, $categories);
-
- if (count($newDiffCategories))
- {
- sort($newDiffCategories);
- }
- else
- {
- $isNewChangeCategory = true;
- }
-
- if ($isChangeCategory && $isNewChangeCategory)
- {
- $newDiffCategories = $categories;
- }
-
- foreach ($newDiffCategories as $newDiffCategory)
- {
- $products = RedshopHelperProduct::getProductCategory($newDiffCategory);
-
- foreach ($products as $product)
- {
- $productData = Redshop::product((int) $product->product_id);
-
- if ($this->type == 1)
- {
- $price = $productData->product_price - ($productData->product_price * $this->amount / 100);
- }
- else
- {
- $price = $productData->product_price - $this->amount;
- }
-
- $price = RedshopHelperProductPrice::priceRound($price);
-
- $query->clear()
- ->update($db->qn('#__redshop_product'))
- ->set($db->qn('product_on_sale') . ' = 1')
- ->set($db->qn('discount_price') . ' = ' . $price)
- ->set($db->qn('discount_stratdate') . ' = ' . $this->start_date)
- ->set($db->qn('discount_enddate') . ' = ' . $this->end_date)
- ->where($db->qn('product_id') . ' = ' . $product->product_id);
-
- if (!$db->setQuery($query)->execute())
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(/** @scrutinizer ignore-deprecated */ $db->getErrorMsg());
-
- return false;
- }
- }
- }
-
- /*
- * Update products for "manufacturer_id"
- */
- $isChangeManufacturer = false;
- $isNewChangeManufacturer = false;
- $manufacturers = $isNew ? array() : explode(',', $oldItem->manufacturer_id);
- $newManufacturers = explode(',', $this->manufacturer_id);
-
- $diffManufacturers = array_diff($manufacturers, $newManufacturers);
-
- if (count($diffManufacturers))
- {
- sort($diffManufacturers);
- }
- else
- {
- $isChangeManufacturer = true;
- }
-
- $diffManufacturers = array_filter(array_values($diffManufacturers));
-
- if (!empty($diffManufacturers))
- {
- $query->clear()
- ->update($db->qn('#__redshop_product'))
- ->set($db->qn('product_on_sale') . ' = 0')
- ->where($db->qn('manufacturer_id') . ' IN (' . implode(',', $diffManufacturers) . ')');
-
- if (!$db->setQuery($query)->execute())
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(/** @scrutinizer ignore-deprecated */ $db->getErrorMsg());
-
- return false;
- }
- }
-
- $newDiffManufacturers = array_diff($newManufacturers, $manufacturers);
-
- if (count($newDiffManufacturers))
- {
- sort($newDiffManufacturers);
- }
- else
- {
- $isNewChangeManufacturer = true;
- }
-
- if ($isNewChangeManufacturer && $isChangeManufacturer)
- {
- $newDiffManufacturers = $manufacturers;
- }
-
- $newDiffManufacturers = array_filter(array_values($newDiffManufacturers));
-
- if (!empty($newDiffManufacturers))
- {
- $query->clear()
- ->select($db->qn('product_id'))
- ->from($db->qn('#__redshop_product'))
- ->where($db->qn('manufacturer_id') . ' IN (' . implode(',', $newDiffManufacturers) . ')');
- $productIds = $db->setQuery($query)->loadColumn();
-
- foreach ($productIds as $productId)
- {
- $productData = Redshop::product((int) $productId);
-
- if ($this->type == 1)
- {
- $price = $productData->product_price - ($productData->product_price * $this->amount / 100);
- }
- else
- {
- $price = $productData->product_price - $this->amount;
- }
-
- $price = RedshopHelperProductPrice::priceRound($price);
-
- $query->clear()
- ->update($db->qn('#__redshop_product'))
- ->set($db->qn('product_on_sale') . ' = 1')
- ->set($db->qn('discount_price') . ' = ' . $price)
- ->set($db->qn('discount_stratdate') . ' = ' . $this->start_date)
- ->set($db->qn('discount_enddate') . ' = ' . $this->end_date)
- ->where($db->qn('product_id') . ' = ' . $productData->product_id);
-
- if (!$db->setQuery($query)->execute())
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(/** @scrutinizer ignore-deprecated */ $db->getErrorMsg());
-
- return false;
- }
- }
- }
-
- return true;
- }
-
- /**
- * Update Product On Sale status
- *
- * @param array|string $productIds List of products.
- *
- * @return boolean
- */
- public function updateProduct($productIds)
- {
- if (empty($productIds))
- {
- return true;
- }
-
- if (is_string($productIds))
- {
- $productIds = explode(',', $productIds);
- }
-
- $productIds = ArrayHelper::toInteger($productIds);
-
- $db = JFactory::getDbo();
- $query = $db->getQuery(true)
- ->update($db->qn('#__redshop_product'))
- ->set($db->qn('product_on_sale') . ' = 0')
- ->set($db->qn('discount_stratdate') . ' = 0')
- ->set($db->qn('discount_enddate') . ' = 0')
- ->set($db->qn('discount_price') . ' = 0')
- ->where($db->qn('product_id') . ' IN (' . implode(',', $productIds) . ')');
-
- return $db->setQuery($query)->execute();
- }
-
- /**
- * Method for get product of manufacturer.
- *
- * @param int $id ID of manufacturer
- *
- * @return mixed
- *
- * @since 2.0.3
- */
- public function getProductsFromManufacturer($id)
- {
- if (!$id)
- {
- return array();
- }
-
- $db = $this->_db;
-
- $query = $db->getQuery(true)
- ->select($db->qn('product_id'))
- ->from($db->qn('#__redshop_product'))
- ->where($db->qn('manufacturer_id') . ' = ' . (int) $id);
-
- return $db->setQuery($query)->loadObjectList();
- }
-
- /**
- * Method for update product base on "discount_product"
- *
- * @param self $data New data
- * @param boolean $isNew Is new or not.
- * @param mixed $oldItem Old data
- *
- * @return boolean
- * @throws Exception
- *
- * @since 2.0.3
- */
- protected function updateProductsBaseDiscountProduct($data, $isNew = false, $oldItem = null)
- {
- $db = $this->_db;
- $query = $db->getQuery(true);
- $isChangeProduct = false;
- $isNewChangeProduct = false;
-
- $discountProducts = $isNew ? array() : explode(',', $oldItem->discount_product);
- $newDiscountProducts = explode(',', $this->discount_product);
-
- $diffProducts = array_filter(array_diff($discountProducts, $newDiscountProducts));
-
- if (count($diffProducts))
- {
- sort($diffProducts);
- }
- else
- {
- $isChangeProduct = true;
- }
-
- if (!empty($diffProducts))
- {
- $query->clear()
- ->update($db->qn('#__redshop_product'))
- ->set($db->qn('product_on_sale') . ' = 0')
- ->where($db->qn('product_id') . ' IN (' . implode(',', $diffProducts) . ')');
-
- if (!$db->setQuery($query)->execute())
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(/** @scrutinizer ignore-deprecated */ $db->getErrorMsg());
-
- return false;
- }
- }
-
- $newDiffProducts = array_diff($newDiscountProducts, $discountProducts);
-
- if (count($newDiffProducts))
- {
- sort($newDiffProducts);
- }
- else
- {
- $isNewChangeProduct = true;
- }
-
- if ($isChangeProduct && $isNewChangeProduct)
- {
- $newDiffProducts = $discountProducts;
- }
-
- $newDiffProducts = array_filter(array_values($newDiffProducts));
-
- if (empty($newDiffProducts))
- {
- return true;
- }
-
- foreach ($newDiffProducts as $newDiffProduct)
- {
- try
- {
- $productData = Redshop::product($newDiffProduct);
-
- // Ticket ONKELP-161: Temporary comment these code to by pass product_on_sale check before apply another mass discount
- if ($this->type == 1)
- {
- $price = $productData->product_price - ($productData->product_price * $this->amount / 100);
- }
- else
- {
- $price = $productData->product_price - $this->amount;
- }
-
- $price = RedshopHelperProductPrice::priceRound($price);
- $query->clear();
-
- // Update fields
- $update = array(
- $db->qn('product_on_sale') . ' = 1',
- $db->qn('discount_price') . ' = ' . (float) $price,
- $db->qn('discount_stratdate') . ' = ' . (int) $this->start_date,
- $db->qn('discount_enddate') . ' = ' . (int) $this->end_date
- );
-
- // By condition
- $conditions = array (
- $db->qn('product_id') . ' = ' . (int) $newDiffProduct
- );
- $query->update($db->qn('#__redshop_product'))->set($update)->where($conditions);
- $db->setQuery($query);
-
- if (!$db->execute())
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg());
-
- return false;
- }
- }
- catch (Exception $e)
- {
- /** @scrutinizer ignore-deprecated */
- $this->/** @scrutinizer ignore-call */ setError($e->getMessage(), 'error');
- }
- }
-
- return true;
- }
+ /**
+ * @var string
+ */
+ public $end_date;
+ /**
+ * @var integer
+ */
+ public $amount;
+ /**
+ * @var integer
+ */
+ public $type;
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_mass_discount';
+
+ /**
+ * Called before bind().
+ *
+ * Method to bind an associative array or object to the JTable instance.This
+ * method only binds properties that are publicly accessible and optionally
+ * takes an array of properties to ignore when binding.
+ *
+ * @param mixed $src An associative array or object to bind to the JTable instance.
+ * @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
+ *
+ * @return boolean True on success.
+ */
+ public function beforeBind(&$src, $ignore = array())
+ {
+ // Bind: Start Date unix
+ if (isset($src['start_date']) && !empty($src['start_date']) && !is_numeric($src['start_date'])) {
+ $date = JFactory::getDate($src['start_date']);
+ $src['start_date'] = $date->toUnix();
+ }
+
+ // Bind: End Date unix
+ if (isset($src['end_date']) && !empty($src['end_date']) && !is_numeric($src['end_date'])) {
+ $date = JFactory::getDate($src['end_date']);
+ $src['end_date'] = $date->toUnix();
+ }
+
+ // Bind: Discount products
+ if (isset($src['discount_product']) && !empty($src['discount_product']) && is_array($src['discount_product'])) {
+ $src['discount_product'] = ArrayHelper::toInteger($src['discount_product']);
+ $src['discount_product'] = array_unique(array_filter($src['discount_product']));
+ $src['discount_product'] = implode(',', $src['discount_product']);
+ }
+
+ // Bind: Categories
+ if (isset($src['category_id']) && !empty($src['category_id']) && is_array($src['category_id'])) {
+ $src['category_id'] = ArrayHelper::toInteger($src['category_id']);
+ $src['category_id'] = array_unique(array_filter($src['category_id']));
+ $src['category_id'] = implode(',', $src['category_id']);
+ }
+
+ // Bind: Manufacturers
+ if (isset($src['manufacturer_id']) && !empty($src['manufacturer_id']) && is_array($src['manufacturer_id'])) {
+ $src['manufacturer_id'] = ArrayHelper::toInteger($src['manufacturer_id']);
+ $src['manufacturer_id'] = array_unique(array_filter($src['manufacturer_id']));
+ $src['manufacturer_id'] = implode(',', $src['manufacturer_id']);
+ }
+
+ return parent::beforeBind($src, $ignore);
+ }
+
+ /**
+ * Method to bind an associative array or object to the JTable instance.This
+ * method only binds properties that are publicly accessible and optionally
+ * takes an array of properties to ignore when binding.
+ *
+ * @param mixed $src An associative array or object to bind to the JTable instance.
+ * @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
+ *
+ * @return boolean True on success.
+ *
+ * @throws \InvalidArgumentException
+ */
+ protected function doBind(&$src, $ignore = array())
+ {
+ if (empty($src['discount_product']) && empty($this->discount_product)) {
+ $this->discount_product = null;
+ unset($src['discount_product']);
+ }
+
+ if (empty($src['category_id']) && empty($this->category_id)) {
+ $this->category_id = null;
+ unset($src['category_id']);
+ }
+
+ return parent::doBind($src, $ignore);
+ }
+
+ /**
+ * Delete one or more registers
+ *
+ * @param string|array $pk Array of ids or ids comma separated
+ *
+ * @return boolean Deleted successfuly?
+ */
+ protected function doDelete($pk = null)
+ {
+ $massDiscountIds = $pk;
+
+ if (!is_array($massDiscountIds)) {
+ $massDiscountIds = array($massDiscountIds);
+ }
+
+ $massDiscountIds = ArrayHelper::toInteger($massDiscountIds);
+ $productIds = array();
+
+ $table = clone $this;
+
+ foreach ($massDiscountIds as $massDiscountId) {
+ if (!$table->load($massDiscountId)) {
+ continue;
+ }
+
+ if (!empty($table->get('discount_product'))) {
+ $this->updateProduct($table->get('discount_product'));
+ }
+
+ $categories = explode(',', $table->category_id);
+ $categories = array_filter(ArrayHelper::toInteger($categories));
+
+ foreach ($categories as $category) {
+ $products = RedshopHelperProduct::getProductCategory($category);
+
+ if (empty($products)) {
+ continue;
+ }
+
+ foreach ($products as $product) {
+ $productIds[] = $product->product_id;
+ }
+ }
+
+ $manufacturers = explode(',', $table->manufacturer_id);
+ $manufacturers = array_filter(ArrayHelper::toInteger($manufacturers));
+
+ foreach ($manufacturers as $manufacturer) {
+ $products = $this->getProductsFromManufacturer($manufacturer);
+
+ if (empty($products)) {
+ continue;
+ }
+
+ foreach ($products as $product) {
+ $productIds[] = $product->product_id;
+ }
+ }
+ }
+
+ if (!empty($productIds)) {
+ $this->updateProduct($productIds);
+ }
+
+ return parent::doDelete($pk);
+ }
+
+ /**
+ * Update Product On Sale status
+ *
+ * @param array|string $productIds List of products.
+ *
+ * @return boolean
+ */
+ public function updateProduct($productIds)
+ {
+ if (empty($productIds)) {
+ return true;
+ }
+
+ if (is_string($productIds)) {
+ $productIds = explode(',', $productIds);
+ }
+
+ $productIds = ArrayHelper::toInteger($productIds);
+
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true)
+ ->update($db->qn('#__redshop_product'))
+ ->set($db->qn('product_on_sale') . ' = 0')
+ ->set($db->qn('discount_stratdate') . ' = 0')
+ ->set($db->qn('discount_enddate') . ' = 0')
+ ->set($db->qn('discount_price') . ' = 0')
+ ->where($db->qn('product_id') . ' IN (' . implode(',', $productIds) . ')');
+
+ return $db->setQuery($query)->execute();
+ }
+
+ /**
+ * Method for get product of manufacturer.
+ *
+ * @param int $id ID of manufacturer
+ *
+ * @return mixed
+ *
+ * @since 2.0.3
+ */
+ public function getProductsFromManufacturer($id)
+ {
+ if (!$id) {
+ return array();
+ }
+
+ $db = $this->_db;
+
+ $query = $db->getQuery(true)
+ ->select($db->qn('product_id'))
+ ->from($db->qn('#__redshop_product'))
+ ->where($db->qn('manufacturer_id') . ' = ' . (int)$id);
+
+ return $db->setQuery($query)->loadObjectList();
+ }
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass
+ * @throws Exception
+ */
+ protected function doCheck()
+ {
+ if (!parent::doCheck()) {
+ return false;
+ }
+
+ if (empty($this->name)) {
+ /** @scrutinizer ignore-deprecated */
+ $this->/** @scrutinizer ignore-call */
+ setError(JText::_('COM_REDSHOP_MASS_DISCOUNT_MISSING_DISCOUNT_NAME'), 'error');
+
+ return false;
+ }
+
+ if (empty($this->amount)) {
+ /** @scrutinizer ignore-deprecated */
+ $this->/** @scrutinizer ignore-call */ setError(
+ JText::_('COM_REDSHOP_MASS_DISCOUNT_DISCOUNT_AMOUNT_MUST_BE_LARGER_THAN_ZERO'),
+ 'error'
+ );
+
+ return false;
+ }
+
+ if (empty($this->discount_product) && empty($this->category_id) && empty($this->manufacturer_id)) {
+ /** @scrutinizer ignore-deprecated */
+ $this->/** @scrutinizer ignore-call */ setError(
+ JText::_('COM_REDSHOP_MASS_DISCOUNT_DETAIL_NO_PRODUCTS_SELECTED'),
+ 'error'
+ );
+
+ return false;
+ }
+
+ if ($this->start_date > $this->end_date) {
+ /** @scrutinizer ignore-deprecated */
+ $this->/** @scrutinizer ignore-call */ setError(
+ JText::_('COM_REDSHOP_MASS_DISCOUNT_ENDDATE_LOWER_STARTDATE'),
+ 'error'
+ );
+
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Called before store(). Overriden to send isNew to plugins.
+ *
+ * @param boolean $updateNulls True to update null values as well.
+ * @param boolean $isNew True if we are adding a new item.
+ * @param mixed $oldItem null for new items | JTable otherwise
+ *
+ * @return boolean True on success.
+ * @throws Exception
+ */
+ protected function beforeStore($updateNulls = false, $isNew = false, $oldItem = null)
+ {
+ if (!parent::beforeStore($updateNulls, $isNew, $oldItem)) {
+ return false;
+ }
+
+ $db = $this->_db;
+ $query = $db->getQuery(true);
+
+ $this->updateProductsBaseDiscountProduct($this, $isNew, $oldItem);
+
+ /*
+ * Update products for "category_id"
+ */
+ $categories = $isNew ? array() : explode(',', $oldItem->category_id);
+ $newCategories = explode(',', $this->category_id);
+ $isChangeCategory = false;
+ $isNewChangeCategory = false;
+
+ $diffCategories = array_diff($categories, $newCategories);
+
+ if (count($diffCategories)) {
+ sort($diffCategories);
+ } else {
+ $isChangeCategory = true;
+ }
+
+ $diffCategories = array_filter(array_values($diffCategories));
+
+ foreach ($diffCategories as $diffCategory) {
+ $products = RedshopHelperProduct::getProductCategory($diffCategory);
+ $productIds = array();
+
+ foreach ($products as $product) {
+ $productIds[] = $product->product_id;
+ }
+
+ if (empty($productIds)) {
+ continue;
+ }
+
+ $query->clear()
+ ->update($db->qn('#__redshop_product'))
+ ->set($db->qn('product_on_sale') . ' = 0')
+ ->where($db->qn('product_id') . ' IN (' . implode(',', $productIds) . ')');
+
+ if (!$db->setQuery($query)->execute()) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(/** @scrutinizer ignore-deprecated */ $db->getErrorMsg());
+
+ return false;
+ }
+ }
+
+ $newDiffCategories = array_diff($newCategories, $categories);
+
+ if (count($newDiffCategories)) {
+ sort($newDiffCategories);
+ } else {
+ $isNewChangeCategory = true;
+ }
+
+ if ($isChangeCategory && $isNewChangeCategory) {
+ $newDiffCategories = $categories;
+ }
+
+ foreach ($newDiffCategories as $newDiffCategory) {
+ $products = RedshopHelperProduct::getProductCategory($newDiffCategory);
+
+ foreach ($products as $product) {
+ $productData = Redshop::product((int)$product->product_id);
+
+ if ($this->type == 1) {
+ $price = $productData->product_price - ($productData->product_price * $this->amount / 100);
+ } else {
+ $price = $productData->product_price - $this->amount;
+ }
+
+ $price = RedshopHelperProductPrice::priceRound($price);
+
+ $query->clear()
+ ->update($db->qn('#__redshop_product'))
+ ->set($db->qn('product_on_sale') . ' = 1')
+ ->set($db->qn('discount_price') . ' = ' . $price)
+ ->set($db->qn('discount_stratdate') . ' = ' . $this->start_date)
+ ->set($db->qn('discount_enddate') . ' = ' . $this->end_date)
+ ->where($db->qn('product_id') . ' = ' . $product->product_id);
+
+ if (!$db->setQuery($query)->execute()) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(/** @scrutinizer ignore-deprecated */ $db->getErrorMsg());
+
+ return false;
+ }
+ }
+ }
+
+ /*
+ * Update products for "manufacturer_id"
+ */
+ $isChangeManufacturer = false;
+ $isNewChangeManufacturer = false;
+ $manufacturers = $isNew ? array() : explode(',', $oldItem->manufacturer_id);
+ $newManufacturers = explode(',', $this->manufacturer_id);
+
+ $diffManufacturers = array_diff($manufacturers, $newManufacturers);
+
+ if (count($diffManufacturers)) {
+ sort($diffManufacturers);
+ } else {
+ $isChangeManufacturer = true;
+ }
+
+ $diffManufacturers = array_filter(array_values($diffManufacturers));
+
+ if (!empty($diffManufacturers)) {
+ $query->clear()
+ ->update($db->qn('#__redshop_product'))
+ ->set($db->qn('product_on_sale') . ' = 0')
+ ->where($db->qn('manufacturer_id') . ' IN (' . implode(',', $diffManufacturers) . ')');
+
+ if (!$db->setQuery($query)->execute()) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(/** @scrutinizer ignore-deprecated */ $db->getErrorMsg());
+
+ return false;
+ }
+ }
+
+ $newDiffManufacturers = array_diff($newManufacturers, $manufacturers);
+
+ if (count($newDiffManufacturers)) {
+ sort($newDiffManufacturers);
+ } else {
+ $isNewChangeManufacturer = true;
+ }
+
+ if ($isNewChangeManufacturer && $isChangeManufacturer) {
+ $newDiffManufacturers = $manufacturers;
+ }
+
+ $newDiffManufacturers = array_filter(array_values($newDiffManufacturers));
+
+ if (!empty($newDiffManufacturers)) {
+ $query->clear()
+ ->select($db->qn('product_id'))
+ ->from($db->qn('#__redshop_product'))
+ ->where($db->qn('manufacturer_id') . ' IN (' . implode(',', $newDiffManufacturers) . ')');
+ $productIds = $db->setQuery($query)->loadColumn();
+
+ foreach ($productIds as $productId) {
+ $productData = Redshop::product((int)$productId);
+
+ if ($this->type == 1) {
+ $price = $productData->product_price - ($productData->product_price * $this->amount / 100);
+ } else {
+ $price = $productData->product_price - $this->amount;
+ }
+
+ $price = RedshopHelperProductPrice::priceRound($price);
+
+ $query->clear()
+ ->update($db->qn('#__redshop_product'))
+ ->set($db->qn('product_on_sale') . ' = 1')
+ ->set($db->qn('discount_price') . ' = ' . $price)
+ ->set($db->qn('discount_stratdate') . ' = ' . $this->start_date)
+ ->set($db->qn('discount_enddate') . ' = ' . $this->end_date)
+ ->where($db->qn('product_id') . ' = ' . $productData->product_id);
+
+ if (!$db->setQuery($query)->execute()) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(/** @scrutinizer ignore-deprecated */ $db->getErrorMsg());
+
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Method for update product base on "discount_product"
+ *
+ * @param self $data New data
+ * @param boolean $isNew Is new or not.
+ * @param mixed $oldItem Old data
+ *
+ * @return boolean
+ * @throws Exception
+ *
+ * @since 2.0.3
+ */
+ protected function updateProductsBaseDiscountProduct($data, $isNew = false, $oldItem = null)
+ {
+ $db = $this->_db;
+ $query = $db->getQuery(true);
+ $isChangeProduct = false;
+ $isNewChangeProduct = false;
+
+ $discountProducts = $isNew ? array() : explode(',', $oldItem->discount_product);
+ $newDiscountProducts = explode(',', $this->discount_product);
+
+ $diffProducts = array_filter(array_diff($discountProducts, $newDiscountProducts));
+
+ if (count($diffProducts)) {
+ sort($diffProducts);
+ } else {
+ $isChangeProduct = true;
+ }
+
+ if (!empty($diffProducts)) {
+ $query->clear()
+ ->update($db->qn('#__redshop_product'))
+ ->set($db->qn('product_on_sale') . ' = 0')
+ ->where($db->qn('product_id') . ' IN (' . implode(',', $diffProducts) . ')');
+
+ if (!$db->setQuery($query)->execute()) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(/** @scrutinizer ignore-deprecated */ $db->getErrorMsg());
+
+ return false;
+ }
+ }
+
+ $newDiffProducts = array_diff($newDiscountProducts, $discountProducts);
+
+ if (count($newDiffProducts)) {
+ sort($newDiffProducts);
+ } else {
+ $isNewChangeProduct = true;
+ }
+
+ if ($isChangeProduct && $isNewChangeProduct) {
+ $newDiffProducts = $discountProducts;
+ }
+
+ $newDiffProducts = array_filter(array_values($newDiffProducts));
+
+ if (empty($newDiffProducts)) {
+ return true;
+ }
+
+ foreach ($newDiffProducts as $newDiffProduct) {
+ try {
+ $productData = Redshop::product($newDiffProduct);
+
+ // Ticket ONKELP-161: Temporary comment these code to by pass product_on_sale check before apply another mass discount
+ if ($this->type == 1) {
+ $price = $productData->product_price - ($productData->product_price * $this->amount / 100);
+ } else {
+ $price = $productData->product_price - $this->amount;
+ }
+
+ $price = RedshopHelperProductPrice::priceRound($price);
+ $query->clear();
+
+ // Update fields
+ $update = array(
+ $db->qn('product_on_sale') . ' = 1',
+ $db->qn('discount_price') . ' = ' . (float)$price,
+ $db->qn('discount_stratdate') . ' = ' . (int)$this->start_date,
+ $db->qn('discount_enddate') . ' = ' . (int)$this->end_date
+ );
+
+ // By condition
+ $conditions = array(
+ $db->qn('product_id') . ' = ' . (int)$newDiffProduct
+ );
+ $query->update($db->qn('#__redshop_product'))->set($update)->where($conditions);
+ $db->setQuery($query);
+
+ if (!$db->execute()) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(/** @scrutinizer ignore-deprecated */ $this->_db->getErrorMsg());
+
+ return false;
+ }
+ } catch (Exception $e) {
+ /** @scrutinizer ignore-deprecated */
+ $this->/** @scrutinizer ignore-call */ setError($e->getMessage(), 'error');
+ }
+ }
+
+ return true;
+ }
}
diff --git a/component/admin/tables/media.php b/component/admin/tables/media.php
index 89664bcd89b..00de20f0e14 100644
--- a/component/admin/tables/media.php
+++ b/component/admin/tables/media.php
@@ -18,98 +18,88 @@
*/
class RedshopTableMedia extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_media';
-
- /**
- * The table key column. Usually: id
- *
- * @var string
- */
- protected $_tableKey = 'media_id';
-
- /**
- * @var integer
- */
- public $media_id;
-
- /**
- * @var string
- */
- public $media_name = '';
-
- /**
- * @var string
- */
- public $media_alternate_text = '';
-
- /**
- * @var string
- */
- public $media_section = '';
-
- /**
- * @var integer
- */
- public $section_id = '';
-
- /**
- * @var string
- */
- public $media_type = '';
-
- /**
- * @var string
- */
- public $media_mimetype = '';
-
- /**
- * @var integer
- */
- public $published = '';
-
- /**
- * @var integer
- */
- public $ordering = '';
-
- /**
- * @var string
- */
- public $scope = '';
-
- /**
- * Delete one or more registers
- *
- * @param string/array $pk Array of ids or ids comma separated
- *
- * @return boolean Deleted successfuly?
- */
- protected function doDelete($pk = null)
- {
- if ($this->media_section == 'images'
- && ($this->media_section == 'manufacturer' || $this->media_section == 'category'))
- {
- // New folder structure
- $folder = JPath::clean(REDSHOP_MEDIA_IMAGE_RELPATH . $this->media_section . '/' . $this->section_id . '/thumb');
-
- if (JFolder::exists($folder))
- {
- JFolder::delete($folder);
- }
-
- $file = JPath::clean(REDSHOP_MEDIA_IMAGE_RELPATH . $this->media_section . '/' . $this->section_id . '/' . $this->media_name);
-
- if (JFile::exists($file))
- {
- JFile::delete($file);
- }
- }
-
- return parent::doDelete($pk);
- }
+ /**
+ * @var integer
+ */
+ public $media_id;
+ /**
+ * @var string
+ */
+ public $media_name = '';
+ /**
+ * @var string
+ */
+ public $media_alternate_text = '';
+ /**
+ * @var string
+ */
+ public $media_section = '';
+ /**
+ * @var integer
+ */
+ public $section_id = '';
+ /**
+ * @var string
+ */
+ public $media_type = '';
+ /**
+ * @var string
+ */
+ public $media_mimetype = '';
+ /**
+ * @var integer
+ */
+ public $published = '';
+ /**
+ * @var integer
+ */
+ public $ordering = '';
+ /**
+ * @var string
+ */
+ public $scope = '';
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_media';
+ /**
+ * The table key column. Usually: id
+ *
+ * @var string
+ */
+ protected $_tableKey = 'media_id';
+
+ /**
+ * Delete one or more registers
+ *
+ * @param string/array $pk Array of ids or ids comma separated
+ *
+ * @return boolean Deleted successfuly?
+ */
+ protected function doDelete($pk = null)
+ {
+ if ($this->media_section == 'images'
+ && ($this->media_section == 'manufacturer' || $this->media_section == 'category')) {
+ // New folder structure
+ $folder = JPath::clean(
+ REDSHOP_MEDIA_IMAGE_RELPATH . $this->media_section . '/' . $this->section_id . '/thumb'
+ );
+
+ if (JFolder::exists($folder)) {
+ JFolder::delete($folder);
+ }
+
+ $file = JPath::clean(
+ REDSHOP_MEDIA_IMAGE_RELPATH . $this->media_section . '/' . $this->section_id . '/' . $this->media_name
+ );
+
+ if (JFile::exists($file)) {
+ JFile::delete($file);
+ }
+ }
+
+ return parent::doDelete($pk);
+ }
}
diff --git a/component/admin/tables/media_detail.php b/component/admin/tables/media_detail.php
index 138d771b3a1..7bf2f0c29d9 100644
--- a/component/admin/tables/media_detail.php
+++ b/component/admin/tables/media_detail.php
@@ -11,40 +11,39 @@
class Tablemedia_detail extends JTable
{
- public $media_id = null;
+ public $media_id = null;
- public $media_name = null;
+ public $media_name = null;
- public $media_alternate_text = null;
+ public $media_alternate_text = null;
- public $media_section = null;
+ public $media_section = null;
- public $section_id = null;
+ public $section_id = null;
- public $media_type = null;
+ public $media_type = null;
- public $media_mimetype = null;
+ public $media_mimetype = null;
- public $published = null;
+ public $published = null;
- public $ordering = null;
+ public $ordering = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'media', 'media_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'media', 'media_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/media_download.php b/component/admin/tables/media_download.php
index 7ecc5317b0e..cb1decb522f 100644
--- a/component/admin/tables/media_download.php
+++ b/component/admin/tables/media_download.php
@@ -11,28 +11,27 @@
class Tablemedia_download extends JTable
{
- public $id = null;
+ public $id = null;
- public $name = null;
+ public $name = null;
- public $media_id = null;
+ public $media_id = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'media_download', 'id', $db);
- }
+ parent::__construct($this->_table_prefix . 'media_download', 'id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/newsletter_detail.php b/component/admin/tables/newsletter_detail.php
index 40bda0ea9b1..9298267863e 100644
--- a/component/admin/tables/newsletter_detail.php
+++ b/component/admin/tables/newsletter_detail.php
@@ -11,34 +11,33 @@
class Tablenewsletter_detail extends JTable
{
- public $newsletter_id = null;
+ public $newsletter_id = null;
- public $name = null;
+ public $name = null;
- public $body = null;
+ public $body = null;
- public $subject = null;
+ public $subject = null;
- public $template_id = null;
+ public $template_id = null;
- public $published = null;
+ public $published = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'newsletter', 'newsletter_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'newsletter', 'newsletter_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/newslettersubscr_detail.php b/component/admin/tables/newslettersubscr_detail.php
index ef52776a7ae..c45a185e998 100644
--- a/component/admin/tables/newslettersubscr_detail.php
+++ b/component/admin/tables/newslettersubscr_detail.php
@@ -11,88 +11,88 @@
class Tablenewslettersubscr_detail extends JTable
{
- public $subscription_id = null;
-
- public $user_id = null;
-
- public $date = null;
-
- public $newsletter_id = null;
-
- public $name = null;
-
- public $email = null;
-
- public $published = null;
-
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
-
- parent::__construct($this->_table_prefix . 'newsletter_subscription', 'subscription_id', $db);
- }
-
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
-
- return parent::bind($array, $ignore);
- }
-
- /**
- * Method to store a row in the database from the JTable instance properties.
- *
- * If a primary key value is set the row with that primary key value will be updated with the instance property values.
- * If no primary key value is set a new row will be inserted into the database with the properties from the JTable instance.
- *
- * @param boolean $updateNulls True to update fields even if they are null.
- *
- * @return boolean True on success.
- *
- * @since 11.1
- */
- public function store($updateNulls = false)
- {
- $isNew = empty($this->subscription_id) ? true : false;
-
- if (!parent::store($updateNulls))
- {
- return false;
- }
-
- JPluginHelper::importPlugin('redshop_user');
- RedshopHelperUtility::getDispatcher()->trigger('addNewsLetterSubscription', array($isNew, $this->getProperties()));
-
- return true;
- }
-
- /**
- * Method to delete a row from the database table by primary key value.
- *
- * @param mixed $pk An optional primary key value to delete. If not set the instance property value is used.
- *
- * @return boolean True on success.
- *
- * @since 11.1
- * @throws UnexpectedValueException
- */
- public function delete($pk = null)
- {
- $data = $this->getProperties();
-
- if (!parent::delete($pk))
- {
- return false;
- }
-
- JPluginHelper::importPlugin('redshop_user');
- RedshopHelperUtility::getDispatcher()->trigger('removeNewsLetterSubscription', array($data));
-
- return true;
- }
+ public $subscription_id = null;
+
+ public $user_id = null;
+
+ public $date = null;
+
+ public $newsletter_id = null;
+
+ public $name = null;
+
+ public $email = null;
+
+ public $published = null;
+
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
+
+ parent::__construct($this->_table_prefix . 'newsletter_subscription', 'subscription_id', $db);
+ }
+
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
+
+ return parent::bind($array, $ignore);
+ }
+
+ /**
+ * Method to store a row in the database from the JTable instance properties.
+ *
+ * If a primary key value is set the row with that primary key value will be updated with the instance property values.
+ * If no primary key value is set a new row will be inserted into the database with the properties from the JTable instance.
+ *
+ * @param boolean $updateNulls True to update fields even if they are null.
+ *
+ * @return boolean True on success.
+ *
+ * @since 11.1
+ */
+ public function store($updateNulls = false)
+ {
+ $isNew = empty($this->subscription_id) ? true : false;
+
+ if (!parent::store($updateNulls)) {
+ return false;
+ }
+
+ JPluginHelper::importPlugin('redshop_user');
+ RedshopHelperUtility::getDispatcher()->trigger(
+ 'addNewsLetterSubscription',
+ array($isNew, $this->getProperties())
+ );
+
+ return true;
+ }
+
+ /**
+ * Method to delete a row from the database table by primary key value.
+ *
+ * @param mixed $pk An optional primary key value to delete. If not set the instance property value is used.
+ *
+ * @return boolean True on success.
+ *
+ * @throws UnexpectedValueException
+ * @since 11.1
+ */
+ public function delete($pk = null)
+ {
+ $data = $this->getProperties();
+
+ if (!parent::delete($pk)) {
+ return false;
+ }
+
+ JPluginHelper::importPlugin('redshop_user');
+ RedshopHelperUtility::getDispatcher()->trigger('removeNewsLetterSubscription', array($data));
+
+ return true;
+ }
}
diff --git a/component/admin/tables/notifystock_user.php b/component/admin/tables/notifystock_user.php
index 74c36729102..6cb72141699 100644
--- a/component/admin/tables/notifystock_user.php
+++ b/component/admin/tables/notifystock_user.php
@@ -11,33 +11,32 @@
class Tablenotifystock_user extends JTable
{
- public $id = null;
+ public $id = null;
- public $product_id = null;
+ public $product_id = null;
- public $propertyId = null;
+ public $propertyId = null;
- public $subPropertyId = null;
+ public $subPropertyId = null;
- public $user_id = null;
+ public $user_id = null;
- public $notification_status = null;
+ public $notification_status = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'notifystock_users', 'id', $db);
- }
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
+ parent::__construct($this->_table_prefix . 'notifystock_users', 'id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/order_acc_item.php b/component/admin/tables/order_acc_item.php
index 56a790b75ae..3f0e060819e 100644
--- a/component/admin/tables/order_acc_item.php
+++ b/component/admin/tables/order_acc_item.php
@@ -11,44 +11,43 @@
class Tableorder_acc_item extends JTable
{
- public $order_item_acc_id = null;
+ public $order_item_acc_id = null;
- public $order_item_id = null;
+ public $order_item_id = null;
- public $product_id = null;
+ public $product_id = null;
- public $order_acc_item_sku = null;
+ public $order_acc_item_sku = null;
- public $order_acc_item_name = null;
+ public $order_acc_item_name = null;
- public $order_acc_price = null;
+ public $order_acc_price = null;
- public $order_acc_vat = null;
+ public $order_acc_vat = null;
- public $product_quantity = null;
+ public $product_quantity = null;
- public $product_acc_item_price = null;
+ public $product_acc_item_price = null;
- public $product_acc_final_price = null;
+ public $product_acc_final_price = null;
- public $product_attribute = null;
+ public $product_attribute = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'order_acc_item', 'order_item_acc_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'order_acc_item', 'order_item_acc_id', $db);
+ }
- function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/order_attribute_item.php b/component/admin/tables/order_attribute_item.php
index 2a621c152b2..b93460815ea 100644
--- a/component/admin/tables/order_attribute_item.php
+++ b/component/admin/tables/order_attribute_item.php
@@ -11,46 +11,45 @@
class Tableorder_attribute_item extends JTable
{
- public $order_att_item_id = null;
+ public $order_att_item_id = null;
- public $order_item_id = null;
+ public $order_item_id = null;
- public $section_id = null;
+ public $section_id = null;
- public $section = null;
+ public $section = null;
- public $parent_section_id = null;
+ public $parent_section_id = null;
- public $section_name = null;
+ public $section_name = null;
- public $section_vat = null;
+ public $section_vat = null;
- public $section_price = null;
+ public $section_price = null;
- public $section_oprand = null;
+ public $section_oprand = null;
- public $is_accessory_att = null;
+ public $is_accessory_att = null;
- public $stockroom_id = null;
+ public $stockroom_id = null;
- public $stockroom_quantity = null;
+ public $stockroom_quantity = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'order_attribute_item', 'order_att_item_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'order_attribute_item', 'order_att_item_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/order_detail.php b/component/admin/tables/order_detail.php
index 5850e52b50b..2f1fa705757 100644
--- a/component/admin/tables/order_detail.php
+++ b/component/admin/tables/order_detail.php
@@ -11,119 +11,120 @@
class Tableorder_detail extends JTable
{
- public $order_id = null;
+ public $order_id = null;
- public $user_id = null;
+ public $user_id = null;
- public $order_number = null;
+ public $order_number = null;
- public $barcode = null;
+ public $barcode = null;
- public $is_booked = 0;
+ public $is_booked = 0;
- public $user_info_id = null;
+ public $user_info_id = null;
- public $order_total = null;
+ public $order_total = null;
- public $order_subtotal = null;
+ public $order_subtotal = null;
- public $order_tax = null;
+ public $order_tax = null;
- public $order_tax_details = null;
+ public $order_tax_details = null;
- public $order_shipping = null;
+ public $order_shipping = null;
- public $order_shipping_tax = null;
+ public $order_shipping_tax = null;
- public $coupon_discount = null;
+ public $coupon_discount = null;
- public $order_discount = null;
+ public $order_discount = null;
- public $order_discount_vat = null;
+ public $order_discount_vat = null;
- public $payment_discount = null;
+ public $payment_discount = null;
- public $special_discount = null;
+ public $special_discount = null;
- public $special_discount_amount = null;
+ public $special_discount_amount = null;
- public $order_status = null;
+ public $order_status = null;
- public $order_payment_status = null;
+ public $order_payment_status = null;
- public $cdate = null;
+ public $cdate = null;
- public $mdate = null;
+ public $mdate = null;
- public $ship_method_id = null;
+ public $ship_method_id = null;
- public $customer_note = null;
+ public $customer_note = null;
- public $ip_address = null;
+ public $ip_address = null;
- public $encr_key = null;
+ public $encr_key = null;
- public $invoice_no = null;
+ public $invoice_no = null;
- public $discount_type = null;
+ public $discount_type = null;
- public $payment_oprand = null;
+ public $payment_oprand = null;
- public $order_label_create = 0;
+ public $order_label_create = 0;
- public $analytics_status = 0;
+ public $analytics_status = 0;
- public $requisition_number = null;
+ public $requisition_number = null;
- public $bookinvoice_number = 0;
+ public $bookinvoice_number = 0;
- public $bookinvoice_date = 0;
+ public $bookinvoice_date = 0;
- public $track_no = null;
+ public $track_no = null;
- public $shop_id = null;
+ public $shop_id = null;
- public $customer_message = null;
+ public $customer_message = null;
- public $referral_code = null;
+ public $referral_code = null;
- public $tax_after_discount;
+ public $tax_after_discount;
- public function __construct(& $db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'orders', 'order_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'orders', 'order_id', $db);
+ }
- /**
- * Validate all table fields before saving
- *
- * @return boolean
- *
- * @since 2.0.0.4
- */
- public function check()
- {
- if (empty($this->order_status) || $this->order_status === 0)
- {
- JFactory::getApplication()->enqueueMessage(JText::_('COM_REDSHOP_TABLE_ORDER_REDSHOP_INVALID_ORDER_STATUS'), 'warning');
+ /**
+ * Validate all table fields before saving
+ *
+ * @return boolean
+ *
+ * @since 2.0.0.4
+ */
+ public function check()
+ {
+ if (empty($this->order_status) || $this->order_status === 0) {
+ JFactory::getApplication()->enqueueMessage(
+ JText::_('COM_REDSHOP_TABLE_ORDER_REDSHOP_INVALID_ORDER_STATUS'),
+ 'warning'
+ );
- return false;
- }
+ return false;
+ }
- return parent::check();
- }
+ return parent::check();
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/order_item_detail.php b/component/admin/tables/order_item_detail.php
index 2ebf60a74cf..359dbb2157f 100644
--- a/component/admin/tables/order_item_detail.php
+++ b/component/admin/tables/order_item_detail.php
@@ -11,82 +11,81 @@
class Tableorder_item_detail extends JTable
{
- public $order_item_id = null;
+ public $order_item_id = null;
- public $order_id = null;
+ public $order_id = null;
- public $user_info_id = null;
+ public $user_info_id = null;
- public $supplier_id = null;
+ public $supplier_id = null;
- public $product_id = null;
+ public $product_id = null;
- public $order_item_sku = null;
+ public $order_item_sku = null;
- public $order_item_name = null;
+ public $order_item_name = null;
- public $product_quantity = null;
+ public $product_quantity = null;
- public $product_item_price = null;
+ public $product_item_price = null;
- public $product_item_old_price = null;
+ public $product_item_old_price = null;
- public $product_item_price_excl_vat = null;
+ public $product_item_price_excl_vat = null;
- public $product_final_price = null;
+ public $product_final_price = null;
- public $order_item_currency = null;
+ public $order_item_currency = null;
- public $order_status = null;
+ public $order_status = null;
- public $customer_note = null;
+ public $customer_note = null;
- public $cdate = null;
+ public $cdate = null;
- public $mdate = null;
+ public $mdate = null;
- public $product_attribute = null;
+ public $product_attribute = null;
- public $discount_calc_data = null;
+ public $discount_calc_data = null;
- public $product_accessory = null;
+ public $product_accessory = null;
- public $delivery_time = null;
+ public $delivery_time = null;
- public $stockroom_id = null;
+ public $stockroom_id = null;
- public $stockroom_quantity = null;
+ public $stockroom_quantity = null;
- public $wrapper_id = null;
+ public $wrapper_id = null;
- public $wrapper_price = null;
+ public $wrapper_price = null;
- public $is_giftcard = 0;
+ public $is_giftcard = 0;
- public $product_purchase_price = 0;
+ public $product_purchase_price = 0;
- public $attribute_image = null;
+ public $attribute_image = null;
- public $giftcard_user_email;
+ public $giftcard_user_email;
- public $giftcard_user_name;
+ public $giftcard_user_name;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'order_item', 'order_item_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'order_item', 'order_item_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/order_payment.php b/component/admin/tables/order_payment.php
index 3671a8180a8..cc06e234738 100644
--- a/component/admin/tables/order_payment.php
+++ b/component/admin/tables/order_payment.php
@@ -11,48 +11,47 @@
class Tableorder_payment extends JTable
{
- public $payment_order_id = null;
+ public $payment_order_id = null;
- public $order_id = null;
+ public $order_id = null;
- public $payment_method_id = null;
+ public $payment_method_id = null;
- public $order_payment_code = null;
+ public $order_payment_code = null;
- public $order_payment_cardname = null;
+ public $order_payment_cardname = null;
- public $order_payment_number = null;
+ public $order_payment_number = null;
- public $order_payment_ccv = null;
+ public $order_payment_ccv = null;
- public $order_payment_expire = null;
+ public $order_payment_expire = null;
- public $order_payment_name = null;
+ public $order_payment_name = null;
- public $order_payment_trans_id = null;
+ public $order_payment_trans_id = null;
- public $order_payment_amount = null;
+ public $order_payment_amount = null;
- public $authorize_status = null;
+ public $authorize_status = null;
- public $payment_method_class;
+ public $payment_method_class;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'order_payment', 'payment_order_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'order_payment', 'payment_order_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/order_status.php b/component/admin/tables/order_status.php
index 73f6342a20c..6f59fe4a1c8 100644
--- a/component/admin/tables/order_status.php
+++ b/component/admin/tables/order_status.php
@@ -16,117 +16,109 @@
* @subpackage Table
* @since 2.0.3
*/
-
class RedshopTableOrder_Status extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_order_status';
-
- /**
- * The table key column. Usually: id
- *
- * @var string
- */
- protected $_tableKey = 'order_status_id';
-
- /**
- * @var integer
- */
- public $order_status_id;
-
- /**
- * @var string
- */
- public $order_status_name;
-
- /**
- * @var string
- */
- public $order_status_code;
-
- /**
- * @var integer
- */
- public $published;
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (empty($this->order_status_name))
- {
- return false;
- }
-
- if (empty($this->order_status_code))
- {
- return false;
- }
-
- if (!parent::doCheck())
- {
- return false;
- }
-
- // Check status code.
- $db = $this->getDbo();
- $query = $db->getQuery(true)
- ->select('COUNT(' . $db->qn('order_status_code') . ') AS ' . $db->qn('count'))
- ->from($db->qn('#__' . $this->_tableName))
- ->where($db->qn('order_status_code') . ' = ' . $db->quote($this->order_status_code));
-
- if ($this->order_status_id)
- {
- $query->where($db->qn('order_status_id') . ' != ' . $this->order_status_id);
- }
-
- if ($db->setQuery($query)->loadResult())
- {
- $this->setError(JText::_('COM_REDSHOP_ORDER_STATUS_ERROR_STATUS_EXIST'));
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Delete one or more registers
- *
- * @param string/array $pk Array of ids or ids comma separated
- *
- * @return boolean Deleted successfuly?
- */
- protected function doDelete($pk = null)
- {
- $db = JFactory::getDbo();
- $query = $db->getQuery(true);
-
- $query->select($db->qn(['s.order_status_id', 's.order_status_code']))
- ->from($db->qn('#__redshop_order_status', 's'))
- ->innerJoin($db->qn('#__redshop_orders', 'o') . ' ON ' . $db->qn('s.order_status_code') . ' = ' . $db->qn('o.order_status'))
- ->where($db->qn('order_status_id') . ' = ' . $db->q($pk));
- $db->setQuery($query);
-
- $check = $db->loadObjectList();
-
- if (count($check) > 0)
- {
- JFactory::getApplication()->enqueueMessage(JText::_('COM_REDSHOP_ORDER_STAUS_FAIL_DELETE'), 'error');
-
- return false;
- }
-
- return parent::doDelete($pk);
- }
+ /**
+ * @var integer
+ */
+ public $order_status_id;
+ /**
+ * @var string
+ */
+ public $order_status_name;
+ /**
+ * @var string
+ */
+ public $order_status_code;
+ /**
+ * @var integer
+ */
+ public $published;
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_order_status';
+ /**
+ * The table key column. Usually: id
+ *
+ * @var string
+ */
+ protected $_tableKey = 'order_status_id';
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (empty($this->order_status_name)) {
+ return false;
+ }
+
+ if (empty($this->order_status_code)) {
+ return false;
+ }
+
+ if (!parent::doCheck()) {
+ return false;
+ }
+
+ // Check status code.
+ $db = $this->getDbo();
+ $query = $db->getQuery(true)
+ ->select('COUNT(' . $db->qn('order_status_code') . ') AS ' . $db->qn('count'))
+ ->from($db->qn('#__' . $this->_tableName))
+ ->where($db->qn('order_status_code') . ' = ' . $db->quote($this->order_status_code));
+
+ if ($this->order_status_id) {
+ $query->where($db->qn('order_status_id') . ' != ' . $this->order_status_id);
+ }
+
+ if ($db->setQuery($query)->loadResult()) {
+ $this->setError(JText::_('COM_REDSHOP_ORDER_STATUS_ERROR_STATUS_EXIST'));
+
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Delete one or more registers
+ *
+ * @param string/array $pk Array of ids or ids comma separated
+ *
+ * @return boolean Deleted successfuly?
+ */
+ protected function doDelete($pk = null)
+ {
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true);
+
+ $query->select($db->qn(['s.order_status_id', 's.order_status_code']))
+ ->from($db->qn('#__redshop_order_status', 's'))
+ ->innerJoin(
+ $db->qn('#__redshop_orders', 'o') . ' ON ' . $db->qn('s.order_status_code') . ' = ' . $db->qn(
+ 'o.order_status'
+ )
+ )
+ ->where($db->qn('order_status_id') . ' = ' . $db->q($pk));
+ $db->setQuery($query);
+
+ $check = $db->loadObjectList();
+
+ if (count($check) > 0) {
+ JFactory::getApplication()->enqueueMessage(JText::_('COM_REDSHOP_ORDER_STAUS_FAIL_DELETE'), 'error');
+
+ return false;
+ }
+
+ return parent::doDelete($pk);
+ }
}
diff --git a/component/admin/tables/order_status_log.php b/component/admin/tables/order_status_log.php
index 5860192468d..320a821d0b0 100644
--- a/component/admin/tables/order_status_log.php
+++ b/component/admin/tables/order_status_log.php
@@ -11,34 +11,33 @@
class Tableorder_status_log extends JTable
{
- public $order_status_log_id = null;
+ public $order_status_log_id = null;
- public $order_id = null;
+ public $order_id = null;
- public $order_status = null;
+ public $order_status = null;
- public $order_payment_status = null;
+ public $order_payment_status = null;
- public $date_changed = null;
+ public $date_changed = null;
- public $customer_note = null;
+ public $customer_note = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'order_status_log', 'order_status_log_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'order_status_log', 'order_status_log_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/order_user_detail.php b/component/admin/tables/order_user_detail.php
index b3c091a201b..83640f8f140 100644
--- a/component/admin/tables/order_user_detail.php
+++ b/component/admin/tables/order_user_detail.php
@@ -11,72 +11,71 @@
class Tableorder_user_detail extends JTable
{
- public $order_info_id = null;
+ public $order_info_id = null;
- public $users_info_id = null;
+ public $users_info_id = null;
- public $order_id = null;
+ public $order_id = null;
- public $user_id = null;
+ public $user_id = null;
- public $firstname = null;
+ public $firstname = null;
- public $address_type = null;
+ public $address_type = null;
- public $lastname = null;
+ public $lastname = null;
- public $vat_number = null;
+ public $vat_number = null;
- public $tax_exempt = 0;
+ public $tax_exempt = 0;
- public $requesting_tax_exempt = 0;
+ public $requesting_tax_exempt = 0;
- public $shopper_group_id = null;
+ public $shopper_group_id = null;
- public $published = null;
+ public $published = null;
- public $isCompany = null;
+ public $isCompany = null;
- public $country_code = null;
+ public $country_code = null;
- public $state_code = null;
+ public $state_code = null;
- public $zipcode = 0;
+ public $zipcode = 0;
- public $phone = 0;
+ public $phone = 0;
- public $city = 0;
+ public $city = 0;
- public $address = 0;
+ public $address = 0;
- public $tax_exempt_approved = 0;
+ public $tax_exempt_approved = 0;
- public $approved = 0;
+ public $approved = 0;
- public $user_email = null;
+ public $user_email = null;
- public $company_name = null;
+ public $company_name = null;
- public $thirdparty_email = null;
+ public $thirdparty_email = null;
- public $ean_number = null;
+ public $ean_number = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'order_users_info', 'order_info_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'order_users_info', 'order_info_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/page_viewer.php b/component/admin/tables/page_viewer.php
index babbe41e735..3ec5e23047b 100644
--- a/component/admin/tables/page_viewer.php
+++ b/component/admin/tables/page_viewer.php
@@ -18,17 +18,17 @@
*/
class RedshopTablePage_Viewer extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_pageviewer';
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_pageviewer';
- /**
- * Format for audit date fields (created_date, modified_date)
- *
- * @var string
- */
- protected $_auditDateFormat = 'U';
+ /**
+ * Format for audit date fields (created_date, modified_date)
+ *
+ * @var string
+ */
+ protected $_auditDateFormat = 'U';
}
diff --git a/component/admin/tables/prices_detail.php b/component/admin/tables/prices_detail.php
index dee6c106a5e..9813c36897b 100644
--- a/component/admin/tables/prices_detail.php
+++ b/component/admin/tables/prices_detail.php
@@ -11,73 +11,73 @@
class Tableprices_detail extends JTable
{
- public $price_id = 0;
+ public $price_id = 0;
- public $product_id = null;
+ public $product_id = null;
- public $product_price = null;
+ public $product_price = null;
- public $product_currency = null;
+ public $product_currency = null;
- public $shopper_group_id = null;
+ public $shopper_group_id = null;
- public $price_quantity_start = 0;
+ public $price_quantity_start = 0;
- public $price_quantity_end = 0;
+ public $price_quantity_end = 0;
- public $cdate = null;
+ public $cdate = null;
- public $discount_price = 0;
+ public $discount_price = 0;
- public $discount_start_date = 0;
+ public $discount_start_date = 0;
- public $discount_end_date = 0;
+ public $discount_end_date = 0;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_price', 'price_id', $db);
- }
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
+ parent::__construct($this->_table_prefix . 'product_price', 'price_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
- public function check()
- {
- // Check for valid name
+ public function check()
+ {
+ // Check for valid name
- $query = 'SELECT price_id FROM ' . $this->_table_prefix . 'product_price WHERE shopper_group_id = "'
- . $this->shopper_group_id . '" AND product_id = ' . (int) $this->product_id
- . ' AND price_quantity_start <= ' . $this->_db->quote($this->price_quantity_start)
- . ' AND price_quantity_end >= ' . $this->_db->quote($this->price_quantity_start) . '';
+ $query = 'SELECT price_id FROM ' . $this->_table_prefix . 'product_price WHERE shopper_group_id = "'
+ . $this->shopper_group_id . '" AND product_id = ' . (int)$this->product_id
+ . ' AND price_quantity_start <= ' . $this->_db->quote($this->price_quantity_start)
+ . ' AND price_quantity_end >= ' . $this->_db->quote($this->price_quantity_start) . '';
- $this->_db->setQuery($query);
- $xid = intval($this->_db->loadResult());
+ $this->_db->setQuery($query);
+ $xid = intval($this->_db->loadResult());
- $query_end = 'SELECT price_id FROM ' . $this->_table_prefix . 'product_price WHERE shopper_group_id = "'
- . $this->shopper_group_id . '" AND product_id = ' . (int) $this->product_id
- . ' AND price_quantity_start <= ' . $this->_db->quote($this->price_quantity_end)
- . ' AND price_quantity_end >= ' . $this->_db->quote($this->price_quantity_end) . '';
+ $query_end = 'SELECT price_id FROM ' . $this->_table_prefix . 'product_price WHERE shopper_group_id = "'
+ . $this->shopper_group_id . '" AND product_id = ' . (int)$this->product_id
+ . ' AND price_quantity_start <= ' . $this->_db->quote($this->price_quantity_end)
+ . ' AND price_quantity_end >= ' . $this->_db->quote($this->price_quantity_end) . '';
- $this->_db->setQuery($query_end);
- $xid_end = intval($this->_db->loadResult());
+ $this->_db->setQuery($query_end);
+ $xid_end = intval($this->_db->loadResult());
- if (($xid || $xid_end) && (($xid != intval($this->price_id) && $xid != 0) || ($xid_end != intval($this->price_id) && $xid_end != 0)))
- {
- $this->_error = JText::sprintf('WARNNAMETRYAGAIN', JText::_('COM_REDSHOP_PRICE_ALREADY_EXISTS'));
+ if (($xid || $xid_end) && (($xid != intval($this->price_id) && $xid != 0) || ($xid_end != intval(
+ $this->price_id
+ ) && $xid_end != 0))) {
+ $this->_error = JText::sprintf('WARNNAMETRYAGAIN', JText::_('COM_REDSHOP_PRICE_ALREADY_EXISTS'));
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
}
diff --git a/component/admin/tables/product_attribute.php b/component/admin/tables/product_attribute.php
index 147ace32cd2..5aebc6901b2 100755
--- a/component/admin/tables/product_attribute.php
+++ b/component/admin/tables/product_attribute.php
@@ -11,46 +11,45 @@
class Tableproduct_attribute extends JTable
{
- public $attributeId = null;
+ public $attributeId = null;
- public $attribute_set_id = 0;
+ public $attribute_set_id = 0;
- public $attribute_name = null;
+ public $attribute_name = null;
- public $attribute_description = null;
+ public $attribute_description = null;
- public $attribute_required = null;
+ public $attribute_required = null;
- public $allow_multiple_selection = 0;
+ public $allow_multiple_selection = 0;
- public $hide_attribute_price = 0;
+ public $hide_attribute_price = 0;
- public $product_id = null;
+ public $product_id = null;
- public $ordering = null;
+ public $ordering = null;
- public $attribute_published = 1;
+ public $attribute_published = 1;
- public $display_type = null;
+ public $display_type = null;
- public $extra_field = null;
+ public $extra_field = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_attribute', 'attribute_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_attribute', 'attribute_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/product_attribute_price_detail.php b/component/admin/tables/product_attribute_price_detail.php
index 6d5b03abae8..751f3d1da6e 100644
--- a/component/admin/tables/product_attribute_price_detail.php
+++ b/component/admin/tables/product_attribute_price_detail.php
@@ -11,46 +11,45 @@
class Tableproduct_attribute_price_detail extends JTable
{
- public $price_id = null;
+ public $price_id = null;
- public $section_id = 0;
+ public $section_id = 0;
- public $section = null;
+ public $section = null;
- public $product_price = 0;
+ public $product_price = 0;
- public $product_currency = null;
+ public $product_currency = null;
- public $cdate = 0;
+ public $cdate = 0;
- public $shopper_group_id = 0;
+ public $shopper_group_id = 0;
- public $price_quantity_start = 0;
+ public $price_quantity_start = 0;
- public $price_quantity_end = 0;
+ public $price_quantity_end = 0;
- public $discount_price = 0;
+ public $discount_price = 0;
- public $discount_start_date = 0;
+ public $discount_start_date = 0;
- public $discount_end_date = 0;
+ public $discount_end_date = 0;
- public function __construct(& $db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_attribute_price', 'price_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_attribute_price', 'price_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/product_compare.php b/component/admin/tables/product_compare.php
index da9561f7baf..97e4e58a6e3 100644
--- a/component/admin/tables/product_compare.php
+++ b/component/admin/tables/product_compare.php
@@ -11,28 +11,27 @@
class Tableproduct_compare extends JTable
{
- public $compare_id = 0;
+ public $compare_id = 0;
- public $product_id = null;
+ public $product_id = null;
- public $user_id = 0;
+ public $user_id = 0;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_compare', 'compare_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_compare', 'compare_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/product_detail.php b/component/admin/tables/product_detail.php
index 16260e8574f..18f0222c48f 100644
--- a/component/admin/tables/product_detail.php
+++ b/component/admin/tables/product_detail.php
@@ -18,210 +18,209 @@
*/
class TableProduct_Detail extends JTable
{
- /**
- * @var integer
- */
- public $attribute_set_id;
-
- /**
- * @var integer
- */
- public $not_for_sale;
-
- /**
- * @var integer
- */
- public $manufacturer_id;
-
- /**
- * @var string
- */
- public $product_name;
-
- /**
- * @var string
- */
- public $product_number;
-
- /**
- * @var string
- */
- public $product_thumb_image;
-
- /**
- * @var string
- */
- public $product_back_thumb_image;
-
- /**
- * @var string
- */
- public $product_full_image;
-
- /**
- * @var string
- */
- public $product_back_full_image;
-
- /**
- * @var string
- */
- public $product_preview_image;
-
- /**
- * @var string
- */
- public $product_preview_back_image;
-
- /**
- * @var integer
- */
- public $product_id;
-
- /**
- * @var float
- */
- public $weight;
-
- /**
- * @var float
- */
- public $product_length;
-
- /**
- * @var float
- */
- public $product_height;
-
- /**
- * @var float
- */
- public $product_width;
-
- /**
- * @var float
- */
- public $product_price;
-
- /**
- * @var integer
- */
- public $min_order_product_quantity;
-
- /**
- * @var integer
- */
- public $max_order_product_quantity;
-
- /**
- * @var integer
- */
- public $product_special;
-
- /**
- * @var integer
- */
- public $expired;
-
- /**
- * @var integer
- */
- public $product_on_sale;
-
- /**
- * @var integer
- */
- public $visited;
-
- /**
- * @var integer
- */
- public $published;
-
- /**
- * @var integer
- */
- public $product_template;
-
- /**
- * @var integer
- */
- public $product_parent_id;
-
- /**
- * @var string
- */
- public $sef_url;
-
- /**
- * @var string
- */
- public $metarobot_info;
-
- /**
- * @var string
- */
- public $product_s_desc;
-
- /**
- * @var string
- */
- public $product_desc;
-
- /**
- * @var string
- */
- public $metadesc;
-
- /**
- * @var string
- */
- public $metakey;
-
- /**
- * @var string
- */
- public $pagetitle;
-
- /**
- * Constructor
- *
- * @param JDatabaseDriver $db Database driver object.
- *
- * @since 11.1
- */
- public function __construct($db)
- {
- parent::__construct('#__redshop_product', 'product_id', $db);
- }
-
- /**
- * Method to check duplicate product number
- *
- * @return boolean True on success
- */
- public function check()
- {
- // Initialiase variables.
- $db = JFactory::getDbo();
- $query = $db->getQuery(true)
- ->select('product_id')
- ->from($db->qn('#__redshop_product'))
- ->where($db->qn('product_number') . ' = ' . $db->q($this->product_number));
-
- // Set the query and load the result.
- $db->setQuery($query);
-
- $duplicateProductId = intval($db->loadResult());
-
- // Make sure we are not checking it's own product number
- if ($duplicateProductId && $duplicateProductId != intval($this->product_id))
- {
- $this->setError(JText::_('COM_REDSHOP_PRODUCT_NUMBER_ALREADY_EXISTS'));
-
- return false;
- }
-
- return true;
- }
+ /**
+ * @var integer
+ */
+ public $attribute_set_id;
+
+ /**
+ * @var integer
+ */
+ public $not_for_sale;
+
+ /**
+ * @var integer
+ */
+ public $manufacturer_id;
+
+ /**
+ * @var string
+ */
+ public $product_name;
+
+ /**
+ * @var string
+ */
+ public $product_number;
+
+ /**
+ * @var string
+ */
+ public $product_thumb_image;
+
+ /**
+ * @var string
+ */
+ public $product_back_thumb_image;
+
+ /**
+ * @var string
+ */
+ public $product_full_image;
+
+ /**
+ * @var string
+ */
+ public $product_back_full_image;
+
+ /**
+ * @var string
+ */
+ public $product_preview_image;
+
+ /**
+ * @var string
+ */
+ public $product_preview_back_image;
+
+ /**
+ * @var integer
+ */
+ public $product_id;
+
+ /**
+ * @var float
+ */
+ public $weight;
+
+ /**
+ * @var float
+ */
+ public $product_length;
+
+ /**
+ * @var float
+ */
+ public $product_height;
+
+ /**
+ * @var float
+ */
+ public $product_width;
+
+ /**
+ * @var float
+ */
+ public $product_price;
+
+ /**
+ * @var integer
+ */
+ public $min_order_product_quantity;
+
+ /**
+ * @var integer
+ */
+ public $max_order_product_quantity;
+
+ /**
+ * @var integer
+ */
+ public $product_special;
+
+ /**
+ * @var integer
+ */
+ public $expired;
+
+ /**
+ * @var integer
+ */
+ public $product_on_sale;
+
+ /**
+ * @var integer
+ */
+ public $visited;
+
+ /**
+ * @var integer
+ */
+ public $published;
+
+ /**
+ * @var integer
+ */
+ public $product_template;
+
+ /**
+ * @var integer
+ */
+ public $product_parent_id;
+
+ /**
+ * @var string
+ */
+ public $sef_url;
+
+ /**
+ * @var string
+ */
+ public $metarobot_info;
+
+ /**
+ * @var string
+ */
+ public $product_s_desc;
+
+ /**
+ * @var string
+ */
+ public $product_desc;
+
+ /**
+ * @var string
+ */
+ public $metadesc;
+
+ /**
+ * @var string
+ */
+ public $metakey;
+
+ /**
+ * @var string
+ */
+ public $pagetitle;
+
+ /**
+ * Constructor
+ *
+ * @param JDatabaseDriver $db Database driver object.
+ *
+ * @since 11.1
+ */
+ public function __construct($db)
+ {
+ parent::__construct('#__redshop_product', 'product_id', $db);
+ }
+
+ /**
+ * Method to check duplicate product number
+ *
+ * @return boolean True on success
+ */
+ public function check()
+ {
+ // Initialiase variables.
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true)
+ ->select('product_id')
+ ->from($db->qn('#__redshop_product'))
+ ->where($db->qn('product_number') . ' = ' . $db->q($this->product_number));
+
+ // Set the query and load the result.
+ $db->setQuery($query);
+
+ $duplicateProductId = intval($db->loadResult());
+
+ // Make sure we are not checking it's own product number
+ if ($duplicateProductId && $duplicateProductId != intval($this->product_id)) {
+ $this->setError(JText::_('COM_REDSHOP_PRODUCT_NUMBER_ALREADY_EXISTS'));
+
+ return false;
+ }
+
+ return true;
+ }
}
diff --git a/component/admin/tables/product_discount_calc.php b/component/admin/tables/product_discount_calc.php
index 33090c03b2d..706a8061bf3 100644
--- a/component/admin/tables/product_discount_calc.php
+++ b/component/admin/tables/product_discount_calc.php
@@ -11,75 +11,77 @@
class Tableproduct_discount_calc extends JTable
{
- public $id = 0;
+ public $id = 0;
- public $product_id = 0;
+ public $product_id = 0;
- public $area_start = 0;
+ public $area_start = 0;
- public $area_end = 0;
+ public $area_end = 0;
- public $area_price = 0;
+ public $area_price = 0;
- public $discount_calc_unit = null;
+ public $discount_calc_unit = null;
- public $area_start_converted = 0;
+ public $area_start_converted = 0;
- public $area_end_converted = 0;
+ public $area_end_converted = 0;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_discount_calc', 'id', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_discount_calc', 'id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
- /**
- * Check for the product ID
- *
- * @return boolean
- */
- public function check()
- {
- $unit = \Redshop\Helper\Utility::getUnitConversation("m", $this->discount_calc_unit);
+ /**
+ * Check for the product ID
+ *
+ * @return boolean
+ */
+ public function check()
+ {
+ $unit = \Redshop\Helper\Utility::getUnitConversation("m", $this->discount_calc_unit);
- $convertedAreaStart = $this->area_start * $unit * $unit;
- $convertedAreaEnd = $this->area_end * $unit * $unit;
+ $convertedAreaStart = $this->area_start * $unit * $unit;
+ $convertedAreaEnd = $this->area_end * $unit * $unit;
- $db = $this->_db;
+ $db = $this->_db;
- $query = $db->getQuery(true)
- ->select('*')
- ->from($db->qn('#__redshop_product_discount_calc'))
- ->where($db->qn('product_id') . ' = ' . (int) $this->product_id)
- ->where(
- '('
- . $convertedAreaStart . ' BETWEEN ' . $db->qn('area_start_converted') . ' AND ' . $db->qn('area_end_converted')
- . ' || ' . $convertedAreaEnd . ' BETWEEN ' . $db->qn('area_start_converted') . ' AND ' . $db->qn('area_end_converted')
- . ')'
- );
+ $query = $db->getQuery(true)
+ ->select('*')
+ ->from($db->qn('#__redshop_product_discount_calc'))
+ ->where($db->qn('product_id') . ' = ' . (int)$this->product_id)
+ ->where(
+ '('
+ . $convertedAreaStart . ' BETWEEN ' . $db->qn('area_start_converted') . ' AND ' . $db->qn(
+ 'area_end_converted'
+ )
+ . ' || ' . $convertedAreaEnd . ' BETWEEN ' . $db->qn('area_start_converted') . ' AND ' . $db->qn(
+ 'area_end_converted'
+ )
+ . ')'
+ );
- $xid = $db->setQuery($query)->loadResult();
+ $xid = $db->setQuery($query)->loadResult();
- if ($xid)
- {
- $this->_error = JText::_('COM_REDSHOP_SAME_RANGE');
+ if ($xid) {
+ $this->_error = JText::_('COM_REDSHOP_SAME_RANGE');
- return false;
- }
+ return false;
+ }
- return true;
- }
+ return true;
+ }
}
diff --git a/component/admin/tables/product_discount_calc_extra.php b/component/admin/tables/product_discount_calc_extra.php
index 543b5c9cf7c..ca875855d0d 100644
--- a/component/admin/tables/product_discount_calc_extra.php
+++ b/component/admin/tables/product_discount_calc_extra.php
@@ -11,32 +11,31 @@
class Tableproduct_discount_calc_extra extends JTable
{
- public $pdcextra_id = 0;
+ public $pdcextra_id = 0;
- public $product_id = 0;
+ public $product_id = 0;
- public $option_name = 0;
+ public $option_name = 0;
- public $oprand = 0;
+ public $oprand = 0;
- public $price = 0;
+ public $price = 0;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_discount_calc_extra', 'pdcextra_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_discount_calc_extra', 'pdcextra_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/product_download.php b/component/admin/tables/product_download.php
index 5b6a65ea6ce..312d565e30f 100644
--- a/component/admin/tables/product_download.php
+++ b/component/admin/tables/product_download.php
@@ -11,38 +11,37 @@
class Tableproduct_download extends JTable
{
- public $product_id = 0;
+ public $product_id = 0;
- public $user_id = 0;
+ public $user_id = 0;
- public $order_id = 0;
+ public $order_id = 0;
- public $end_date = 0;
+ public $end_date = 0;
- public $download_max = 0;
+ public $download_max = 0;
- public $download_id = null;
+ public $download_id = null;
- public $file_name = null;
+ public $file_name = null;
- public $product_serial_number = null;
+ public $product_serial_number = null;
- public function __construct(& $db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_download', '', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_download', '', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/product_serial_number.php b/component/admin/tables/product_serial_number.php
index 5383bbcd329..0d2b9904a1b 100644
--- a/component/admin/tables/product_serial_number.php
+++ b/component/admin/tables/product_serial_number.php
@@ -11,30 +11,29 @@
class Tableproduct_serial_number extends JTable
{
- public $serial_id = null;
+ public $serial_id = null;
- public $product_id = null;
+ public $product_id = null;
- public $serial_number = "";
+ public $serial_number = "";
- public $is_used = 0;
+ public $is_used = 0;
- public function __construct(& $db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_serial_number', 'serial_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_serial_number', 'serial_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/product_subscribe_detail.php b/component/admin/tables/product_subscribe_detail.php
index 3dc3393da38..8d8b5688909 100644
--- a/component/admin/tables/product_subscribe_detail.php
+++ b/component/admin/tables/product_subscribe_detail.php
@@ -11,38 +11,37 @@
class Tableproduct_subscribe_detail extends JTable
{
- public $product_subscribe_id = 0;
+ public $product_subscribe_id = 0;
- public $order_id = 0;
+ public $order_id = 0;
- public $order_item_id = 0;
+ public $order_item_id = 0;
- public $product_id = 0;
+ public $product_id = 0;
- public $subscription_id = 0;
+ public $subscription_id = 0;
- public $user_id = 0;
+ public $user_id = 0;
- public $start_date = 0;
+ public $start_date = 0;
- public $end_date = 0;
+ public $end_date = 0;
- public function __construct(& $db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_subscribe_detail', 'product_subscribe_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_subscribe_detail', 'product_subscribe_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/product_subscription.php b/component/admin/tables/product_subscription.php
index 5001f0eaf07..54c0e10c421 100644
--- a/component/admin/tables/product_subscription.php
+++ b/component/admin/tables/product_subscription.php
@@ -11,32 +11,31 @@
class Tableproduct_subscription extends JTable
{
- public $subscription_id = 0;
+ public $subscription_id = 0;
- public $product_id = 0;
+ public $product_id = 0;
- public $subscription_period = 0;
+ public $subscription_period = 0;
- public $period_type = null;
+ public $period_type = null;
- public $subscription_price = null;
+ public $subscription_price = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_subscription', 'subscription_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_subscription', 'subscription_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/product_subscription_renewal.php b/component/admin/tables/product_subscription_renewal.php
index 4fd3b6f5d51..8d2ef28c841 100644
--- a/component/admin/tables/product_subscription_renewal.php
+++ b/component/admin/tables/product_subscription_renewal.php
@@ -11,28 +11,27 @@
class Tableproduct_subscription_renewal extends JTable
{
- public $renewal_id = 0;
+ public $renewal_id = 0;
- public $product_id = 0;
+ public $product_id = 0;
- public $before_no_days = 0;
+ public $before_no_days = 0;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'subscription_renewal', 'renewal_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'subscription_renewal', 'renewal_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/product_tags.php b/component/admin/tables/product_tags.php
index 257e3617c82..739ec18a30d 100644
--- a/component/admin/tables/product_tags.php
+++ b/component/admin/tables/product_tags.php
@@ -11,30 +11,29 @@
class Tableproduct_tags extends JTable
{
- public $tags_id = 0;
+ public $tags_id = 0;
- public $tags_name = null;
+ public $tags_name = null;
- public $tags_counter = 0;
+ public $tags_counter = 0;
- public $published = 0;
+ public $published = 0;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_tags', 'tags_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_tags', 'tags_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/question.php b/component/admin/tables/question.php
index c6002c95e36..c3950104be2 100644
--- a/component/admin/tables/question.php
+++ b/component/admin/tables/question.php
@@ -18,33 +18,31 @@
*/
class RedshopTableQuestion extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_customer_question';
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_customer_question';
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (!parent::doCheck())
- {
- return false;
- }
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (!parent::doCheck()) {
+ return false;
+ }
- if (isset($this->question_date) || empty($this->question_date))
- {
- $this->question_date = time();
- }
+ if (isset($this->question_date) || empty($this->question_date)) {
+ $this->question_date = time();
+ }
- return true;
- }
+ return true;
+ }
}
diff --git a/component/admin/tables/quotation_accessory_item.php b/component/admin/tables/quotation_accessory_item.php
index 52eb8b1f5ef..420ec9f1a74 100644
--- a/component/admin/tables/quotation_accessory_item.php
+++ b/component/admin/tables/quotation_accessory_item.php
@@ -11,44 +11,43 @@
class Tablequotation_accessory_item extends JTable
{
- public $quotation_item_acc_id = null;
+ public $quotation_item_acc_id = null;
- public $quotation_item_id = null;
+ public $quotation_item_id = null;
- public $accessoryId = null;
+ public $accessoryId = null;
- public $accessory_item_sku = null;
+ public $accessory_item_sku = null;
- public $accessory_item_name = null;
+ public $accessory_item_name = null;
- public $accessory_price = null;
+ public $accessory_price = null;
- public $accessory_vat = null;
+ public $accessory_vat = null;
- public $accessory_quantity = null;
+ public $accessory_quantity = null;
- public $accessory_item_price = null;
+ public $accessory_item_price = null;
- public $accessory_final_price = null;
+ public $accessory_final_price = null;
- public $accessory_attribute = null;
+ public $accessory_attribute = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'quotation_accessory_item', 'quotation_item_acc_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'quotation_accessory_item', 'quotation_item_acc_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/quotation_attribute_item.php b/component/admin/tables/quotation_attribute_item.php
index afbeced6e0a..2ef96fc61bc 100644
--- a/component/admin/tables/quotation_attribute_item.php
+++ b/component/admin/tables/quotation_attribute_item.php
@@ -11,42 +11,41 @@
class Tablequotation_attribute_item extends JTable
{
- public $quotation_att_item_id = null;
+ public $quotation_att_item_id = null;
- public $quotation_item_id = null;
+ public $quotation_item_id = null;
- public $section_id = null;
+ public $section_id = null;
- public $section = null;
+ public $section = null;
- public $parent_section_id = null;
+ public $parent_section_id = null;
- public $section_name = null;
+ public $section_name = null;
- public $section_vat = null;
+ public $section_vat = null;
- public $section_price = null;
+ public $section_price = null;
- public $section_oprand = null;
+ public $section_oprand = null;
- public $is_accessory_att = null;
+ public $is_accessory_att = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'quotation_attribute_item', 'quotation_att_item_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'quotation_attribute_item', 'quotation_att_item_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/quotation_detail.php b/component/admin/tables/quotation_detail.php
index 5b5b8ba215c..84fcdac4463 100644
--- a/component/admin/tables/quotation_detail.php
+++ b/component/admin/tables/quotation_detail.php
@@ -11,58 +11,57 @@
class Tablequotation_detail extends JTable
{
- public $quotation_id = null;
+ public $quotation_id = null;
- public $quotation_number = null;
+ public $quotation_number = null;
- public $user_id = null;
+ public $user_id = null;
- public $user_info_id = null;
+ public $user_info_id = null;
- public $user_email = null;
+ public $user_email = null;
- public $order_id = null;
+ public $order_id = null;
- public $quotation_total = null;
+ public $quotation_total = null;
- public $quotation_subtotal = null;
+ public $quotation_subtotal = null;
- public $quotation_tax = null;
+ public $quotation_tax = null;
- public $quotation_discount = 0;
+ public $quotation_discount = 0;
- public $quotation_special_discount = 0;
+ public $quotation_special_discount = 0;
- public $quotation_status = null;
+ public $quotation_status = null;
- public $quotation_cdate = null;
+ public $quotation_cdate = null;
- public $quotation_mdate = null;
+ public $quotation_mdate = null;
- public $quotation_note = null;
+ public $quotation_note = null;
- public $quotation_customer_note = null;
+ public $quotation_customer_note = null;
- public $quotation_ipaddress = null;
+ public $quotation_ipaddress = null;
- public $quotation_encrkey = null;
+ public $quotation_encrkey = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'quotation', 'quotation_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'quotation', 'quotation_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/quotation_item_detail.php b/component/admin/tables/quotation_item_detail.php
index a32da844be6..56b39d72da6 100644
--- a/component/admin/tables/quotation_item_detail.php
+++ b/component/admin/tables/quotation_item_detail.php
@@ -11,51 +11,50 @@
class Tablequotation_item_detail extends JTable
{
- public $quotation_item_id = null;
+ public $quotation_item_id = null;
- public $quotation_id = null;
+ public $quotation_id = null;
- public $product_id = null;
+ public $product_id = null;
- public $product_name = null;
+ public $product_name = null;
- public $product_price = null;
+ public $product_price = null;
- public $actualitem_price = null;
+ public $actualitem_price = null;
- public $product_excl_price = null;
+ public $product_excl_price = null;
- public $product_final_price = null;
+ public $product_final_price = null;
- public $product_quantity = null;
+ public $product_quantity = null;
- public $product_attribute = null;
+ public $product_attribute = null;
- public $product_accessory = null;
+ public $product_accessory = null;
- public $mycart_accessory = null;
+ public $mycart_accessory = null;
- public $product_wrapperid = null;
+ public $product_wrapperid = null;
- public $wrapper_price = null;
+ public $wrapper_price = null;
- public $is_giftcard = null;
+ public $is_giftcard = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'quotation_item', 'quotation_item_id', $db);
- }
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
+ parent::__construct($this->_table_prefix . 'quotation_item', 'quotation_item_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/rating_detail.php b/component/admin/tables/rating_detail.php
index 2602c989eaf..42025b347f5 100644
--- a/component/admin/tables/rating_detail.php
+++ b/component/admin/tables/rating_detail.php
@@ -11,27 +11,26 @@
class RedshopTableRating_detail extends JTable
{
- /**
- * Constructor
- *
- * @param JDatabaseDriver $db Database driver object.
- *
- * @since 11.1
- */
- public function __construct($db)
- {
- parent::__construct('#__redshop_product_rating', 'rating_id', $db);
- }
+ /**
+ * Constructor
+ *
+ * @param JDatabaseDriver $db Database driver object.
+ *
+ * @since 11.1
+ */
+ public function __construct($db)
+ {
+ parent::__construct('#__redshop_product_rating', 'rating_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/related_product.php b/component/admin/tables/related_product.php
index e36e0e06fd2..0d149416381 100644
--- a/component/admin/tables/related_product.php
+++ b/component/admin/tables/related_product.php
@@ -11,26 +11,25 @@
class Tablerelated_product extends JTable
{
- public $related_id = null;
+ public $related_id = null;
- public $product_id = null;
+ public $product_id = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_related', 'related_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_related', 'related_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/sample_detail.php b/component/admin/tables/sample_detail.php
index 818826d873e..fffc684a5fb 100644
--- a/component/admin/tables/sample_detail.php
+++ b/component/admin/tables/sample_detail.php
@@ -11,28 +11,27 @@
class Tablesample_detail extends JTable
{
- public $sample_id = null;
+ public $sample_id = null;
- public $sample_name = null;
+ public $sample_name = null;
- public $published = null;
+ public $published = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'catalog_sample', 'sample_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'catalog_sample', 'sample_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/sample_request.php b/component/admin/tables/sample_request.php
index d8fce837d29..556cb004a92 100644
--- a/component/admin/tables/sample_request.php
+++ b/component/admin/tables/sample_request.php
@@ -11,34 +11,33 @@
class Tablesample_request extends JTable
{
- public $request_id = null;
+ public $request_id = null;
- public $colour_id = null;
+ public $colour_id = null;
- public $name = null;
+ public $name = null;
- public $email = null;
+ public $email = null;
- public $registerdate = null;
+ public $registerdate = null;
- public $block = null;
+ public $block = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'sample_request', 'request_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'sample_request', 'request_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/shipping_box.php b/component/admin/tables/shipping_box.php
index 7d3c8d0db1e..bf7bc301072 100644
--- a/component/admin/tables/shipping_box.php
+++ b/component/admin/tables/shipping_box.php
@@ -18,90 +18,82 @@
*/
class RedshopTableShipping_Box extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_shipping_boxes';
-
- /**
- * The table key column. Usually: id
- *
- * @var string
- */
- protected $_tableKey = 'shipping_box_id';
-
- /**
- * @var integer
- */
- public $shipping_box_id = null;
-
- /**
- * @var float
- */
- public $shipping_box_name = null;
-
- /**
- * @var float
- */
- public $shipping_box_length = null;
-
- /**
- * @var float
- */
- public $shipping_box_width = null;
-
- /**
- * @var float
- */
- public $shipping_box_height = null;
-
- /**
- * @var integer
- */
- public $shipping_box_priority = null;
-
- /**
- * @var integer
- */
- public $published = null;
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- $this->shipping_box_length = floatval($this->shipping_box_length);
- $this->shipping_box_width = floatval($this->shipping_box_width);
- $this->shipping_box_height = floatval($this->shipping_box_height);
-
- if ($this->shipping_box_length <= 0.0)
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_SHIPPING_BOX_ERROR_LENGTH_INVALID'));
-
- return false;
- }
-
- if ($this->shipping_box_width <= 0.0)
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_SHIPPING_BOX_ERROR_WIDTH_INVALID'));
-
- return false;
- }
-
- if ($this->shipping_box_height <= 0.0)
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_SHIPPING_BOX_ERROR_HEIGHT_INVALID'));
-
- return false;
- }
-
- return parent::doCheck();
- }
+ /**
+ * @var integer
+ */
+ public $shipping_box_id = null;
+ /**
+ * @var float
+ */
+ public $shipping_box_name = null;
+ /**
+ * @var float
+ */
+ public $shipping_box_length = null;
+ /**
+ * @var float
+ */
+ public $shipping_box_width = null;
+ /**
+ * @var float
+ */
+ public $shipping_box_height = null;
+ /**
+ * @var integer
+ */
+ public $shipping_box_priority = null;
+ /**
+ * @var integer
+ */
+ public $published = null;
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_shipping_boxes';
+ /**
+ * The table key column. Usually: id
+ *
+ * @var string
+ */
+ protected $_tableKey = 'shipping_box_id';
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ $this->shipping_box_length = floatval($this->shipping_box_length);
+ $this->shipping_box_width = floatval($this->shipping_box_width);
+ $this->shipping_box_height = floatval($this->shipping_box_height);
+
+ if ($this->shipping_box_length <= 0.0) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_SHIPPING_BOX_ERROR_LENGTH_INVALID'));
+
+ return false;
+ }
+
+ if ($this->shipping_box_width <= 0.0) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_SHIPPING_BOX_ERROR_WIDTH_INVALID'));
+
+ return false;
+ }
+
+ if ($this->shipping_box_height <= 0.0) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_SHIPPING_BOX_ERROR_HEIGHT_INVALID'));
+
+ return false;
+ }
+
+ return parent::doCheck();
+ }
}
diff --git a/component/admin/tables/shipping_detail.php b/component/admin/tables/shipping_detail.php
index 7df83de60be..cff6a23edbc 100644
--- a/component/admin/tables/shipping_detail.php
+++ b/component/admin/tables/shipping_detail.php
@@ -11,40 +11,39 @@
class Tableshipping_detail extends JTable
{
- public $shipping_id = null;
+ public $shipping_id = null;
- public $shipping_name = null;
+ public $shipping_name = null;
- public $shipping_class = null;
+ public $shipping_class = null;
- public $shipping_method_code = null;
+ public $shipping_method_code = null;
- public $published = null;
+ public $published = null;
- public $shipping_details = null;
+ public $shipping_details = null;
- public $params = null;
+ public $params = null;
- public $plugin = null;
+ public $plugin = null;
- public $ordering = null;
+ public $ordering = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__extensions';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__extensions';
- parent::__construct($this->_table_prefix, 'extension_id', $db);
- }
+ parent::__construct($this->_table_prefix, 'extension_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/shipping_rate_detail.php b/component/admin/tables/shipping_rate_detail.php
index c82dc2787a2..b5eded575bb 100644
--- a/component/admin/tables/shipping_rate_detail.php
+++ b/component/admin/tables/shipping_rate_detail.php
@@ -11,86 +11,85 @@
class Tableshipping_rate_detail extends JTable
{
- public $shipping_rate_id = null;
+ public $shipping_rate_id = null;
- public $shipping_rate_name = null;
+ public $shipping_rate_name = null;
- public $shipping_class = null;
+ public $shipping_class = null;
- public $shipping_rate_country = null;
+ public $shipping_rate_country = null;
- public $shipping_rate_volume_start = null;
+ public $shipping_rate_volume_start = null;
- public $shipping_rate_volume_end = null;
+ public $shipping_rate_volume_end = null;
- public $shipping_rate_weight_start = null;
+ public $shipping_rate_weight_start = null;
- public $shipping_rate_weight_end = null;
+ public $shipping_rate_weight_end = null;
- public $shipping_rate_ordertotal_start = null;
+ public $shipping_rate_ordertotal_start = null;
- public $shipping_rate_ordertotal_end = null;
+ public $shipping_rate_ordertotal_end = null;
- public $shipping_rate_zip_start = null;
+ public $shipping_rate_zip_start = null;
- public $shipping_rate_zip_end = null;
+ public $shipping_rate_zip_end = null;
- public $shipping_rate_value = null;
+ public $shipping_rate_value = null;
- public $shipping_rate_priority = null;
+ public $shipping_rate_priority = null;
- public $shipping_rate_package_fee = null;
+ public $shipping_rate_package_fee = null;
- public $shipping_rate_on_product = null;
+ public $shipping_rate_on_product = null;
- public $shipping_rate_on_category = null;
+ public $shipping_rate_on_category = null;
- public $company_only = null;
+ public $company_only = null;
- public $apply_vat = 0;
+ public $apply_vat = 0;
- public $shipping_location_info = null;
+ public $shipping_location_info = null;
- public $shipping_rate_length_start = 0;
+ public $shipping_rate_length_start = 0;
- public $shipping_rate_length_end = 0;
+ public $shipping_rate_length_end = 0;
- public $shipping_rate_width_start = 0;
+ public $shipping_rate_width_start = 0;
- public $shipping_rate_width_end = 0;
+ public $shipping_rate_width_end = 0;
- public $shipping_rate_height_start = 0;
+ public $shipping_rate_height_start = 0;
- public $shipping_rate_height_end = 0;
+ public $shipping_rate_height_end = 0;
- public $shipping_tax_group_id = null;
+ public $shipping_tax_group_id = null;
- public $shipping_rate_state = null;
+ public $shipping_rate_state = null;
- public $shipping_rate_on_shopper_group = null;
+ public $shipping_rate_on_shopper_group = null;
- public $consignor_carrier_code = null;
+ public $consignor_carrier_code = null;
- public $economic_displaynumber = null;
+ public $economic_displaynumber = null;
- public $deliver_type = null;
+ public $deliver_type = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'shipping_rate', 'shipping_rate_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'shipping_rate', 'shipping_rate_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/shopper_group_detail.php b/component/admin/tables/shopper_group_detail.php
index d9635a40fb1..7ab7007dc8c 100644
--- a/component/admin/tables/shopper_group_detail.php
+++ b/component/admin/tables/shopper_group_detail.php
@@ -11,66 +11,65 @@
class Tableshopper_group_detail extends JTable
{
- public $shopper_group_id = null;
+ public $shopper_group_id = null;
- public $shopper_group_name = null;
+ public $shopper_group_name = null;
- public $shopper_group_customer_type = null;
+ public $shopper_group_customer_type = null;
- public $shopper_group_portal = null;
+ public $shopper_group_portal = null;
- public $shopper_group_categories = null;
+ public $shopper_group_categories = null;
- public $shopper_group_url = null;
+ public $shopper_group_url = null;
- public $shopper_group_logo = null;
+ public $shopper_group_logo = null;
- public $shopper_group_introtext = null;
+ public $shopper_group_introtext = null;
- public $shopper_group_desc = null;
+ public $shopper_group_desc = null;
- public $parent_id = null;
+ public $parent_id = null;
- public $default_shipping = 0;
+ public $default_shipping = 0;
- public $default_shipping_rate = null;
+ public $default_shipping_rate = null;
- public $show_price_without_vat = 0;
+ public $show_price_without_vat = 0;
- public $show_price = 'global';
+ public $show_price = 'global';
- public $use_as_catalog = 'global';
+ public $use_as_catalog = 'global';
- public $published = null;
+ public $published = null;
- public $shopper_group_cart_checkout_itemid = 0;
+ public $shopper_group_cart_checkout_itemid = 0;
- public $tax_group_id = 0;
+ public $tax_group_id = 0;
- public $apply_product_price_vat = 0;
+ public $apply_product_price_vat = 0;
- public $shopper_group_cart_itemid = 0;
+ public $shopper_group_cart_itemid = 0;
- public $shopper_group_quotation_mode = 0;
+ public $shopper_group_quotation_mode = 0;
- public $shopper_group_manufactures = null;
+ public $shopper_group_manufactures = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'shopper_group', 'shopper_group_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'shopper_group', 'shopper_group_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/site_viewer.php b/component/admin/tables/site_viewer.php
index f773fafab01..390dca7f2b5 100644
--- a/component/admin/tables/site_viewer.php
+++ b/component/admin/tables/site_viewer.php
@@ -18,17 +18,17 @@
*/
class RedshopTableSite_Viewer extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_siteviewer';
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_siteviewer';
- /**
- * Format for audit date fields (created_date, modified_date)
- *
- * @var string
- */
- protected $_auditDateFormat = 'U';
+ /**
+ * Format for audit date fields (created_date, modified_date)
+ *
+ * @var string
+ */
+ protected $_auditDateFormat = 'U';
}
diff --git a/component/admin/tables/state.php b/component/admin/tables/state.php
index f8ab6bb87f8..5b8cc830e1e 100644
--- a/component/admin/tables/state.php
+++ b/component/admin/tables/state.php
@@ -18,94 +18,85 @@
*/
class RedshopTableState extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_state';
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (empty($this->country_id))
- {
- return false;
- }
-
- if (empty($this->state_name))
- {
- return false;
- }
-
- if (empty($this->state_3_code))
- {
- return false;
- }
-
- if (empty($this->state_2_code))
- {
- return false;
- }
-
- if (!parent::doCheck())
- {
- return false;
- }
-
- $db = JFactory::getDbo();
-
- $query = $db->getQuery(true);
- $query->select([$db->qn('id'), $db->qn('state_3_code')])
- ->from($db->qn('#__redshop_state'))
- ->where(
- $db->qn('state_3_code') . ' = ' . $db->q($this->state_3_code)
- . ' AND ' . $db->qn('id') . ' != ' . $db->q($this->id)
- . ' AND ' . $db->qn('country_id') . ' = ' . $db->q($this->country_id)
- );
-
- $db->setQuery($query);
-
- $xid = intval($db->loadResult());
-
- if ($xid)
- {
- $this->_error = JText::_('COM_REDSHOP_STATE_CODE3_ALREADY_EXISTS');
- JError::raiseWarning('', $this->_error);
-
- return false;
- }
- else
- {
- $query = $db->getQuery(true);
-
- $query->select([$db->qn('id'), $db->qn('state_3_code'), $db->qn('state_2_code')])
- ->from($db->qn('#__redshop_state'))
- ->where(
- $db->qn('state_2_code') . ' = ' . $db->q($this->state_2_code)
- . ' AND ' . $db->qn('id') . ' != ' . $db->q($this->id)
- . ' AND ' . $db->qn('country_id') . ' = ' . $db->q($this->country_id)
- );
-
- $db->setQuery($query);
- $xid = intval($db->loadResult());
-
- if ($xid)
- {
- $this->_error = JText::_('COM_REDSHOP_STATE_CODE2_ALREADY_EXISTS');
- JError::raiseWarning('', $this->_error);
-
- return false;
- }
- }
-
- return true;
- }
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_state';
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (empty($this->country_id)) {
+ return false;
+ }
+
+ if (empty($this->state_name)) {
+ return false;
+ }
+
+ if (empty($this->state_3_code)) {
+ return false;
+ }
+
+ if (empty($this->state_2_code)) {
+ return false;
+ }
+
+ if (!parent::doCheck()) {
+ return false;
+ }
+
+ $db = JFactory::getDbo();
+
+ $query = $db->getQuery(true);
+ $query->select([$db->qn('id'), $db->qn('state_3_code')])
+ ->from($db->qn('#__redshop_state'))
+ ->where(
+ $db->qn('state_3_code') . ' = ' . $db->q($this->state_3_code)
+ . ' AND ' . $db->qn('id') . ' != ' . $db->q($this->id)
+ . ' AND ' . $db->qn('country_id') . ' = ' . $db->q($this->country_id)
+ );
+
+ $db->setQuery($query);
+
+ $xid = intval($db->loadResult());
+
+ if ($xid) {
+ $this->_error = JText::_('COM_REDSHOP_STATE_CODE3_ALREADY_EXISTS');
+ JError::raiseWarning('', $this->_error);
+
+ return false;
+ } else {
+ $query = $db->getQuery(true);
+
+ $query->select([$db->qn('id'), $db->qn('state_3_code'), $db->qn('state_2_code')])
+ ->from($db->qn('#__redshop_state'))
+ ->where(
+ $db->qn('state_2_code') . ' = ' . $db->q($this->state_2_code)
+ . ' AND ' . $db->qn('id') . ' != ' . $db->q($this->id)
+ . ' AND ' . $db->qn('country_id') . ' = ' . $db->q($this->country_id)
+ );
+
+ $db->setQuery($query);
+ $xid = intval($db->loadResult());
+
+ if ($xid) {
+ $this->_error = JText::_('COM_REDSHOP_STATE_CODE2_ALREADY_EXISTS');
+ JError::raiseWarning('', $this->_error);
+
+ return false;
+ }
+ }
+
+ return true;
+ }
}
diff --git a/component/admin/tables/stockimage_detail.php b/component/admin/tables/stockimage_detail.php
index ca24d9f6c56..27bdecd4cf1 100644
--- a/component/admin/tables/stockimage_detail.php
+++ b/component/admin/tables/stockimage_detail.php
@@ -11,33 +11,32 @@
class Tablestockimage_detail extends JTable
{
- public $stock_amount_id = null;
+ public $stock_amount_id = null;
- public $stockroom_id = null;
+ public $stockroom_id = null;
- public $stock_option = null;
+ public $stock_option = null;
- public $stock_quantity = null;
+ public $stock_quantity = null;
- public $stock_amount_image = null;
+ public $stock_amount_image = null;
- public $stock_amount_image_tooltip = null;
+ public $stock_amount_image_tooltip = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'stockroom_amount_image', 'stock_amount_id', $db);
- }
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
+ parent::__construct($this->_table_prefix . 'stockroom_amount_image', 'stock_amount_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/stockroom_detail.php b/component/admin/tables/stockroom_detail.php
index 86afe88ad3a..e1a47ab4499 100644
--- a/component/admin/tables/stockroom_detail.php
+++ b/component/admin/tables/stockroom_detail.php
@@ -11,42 +11,41 @@
class Tablestockroom_detail extends JTable
{
- public $stockroom_id = null;
+ public $stockroom_id = null;
- public $stockroom_name = null;
+ public $stockroom_name = null;
- public $min_stock_amount = 0;
+ public $min_stock_amount = 0;
- public $stockroom_desc = null;
+ public $stockroom_desc = null;
- public $creation_date = null;
+ public $creation_date = null;
- public $min_del_time = null;
+ public $min_del_time = null;
- public $max_del_time = null;
+ public $max_del_time = null;
- public $show_in_front = 0;
+ public $show_in_front = 0;
- public $delivery_time = 'Days';
+ public $delivery_time = 'Days';
- public $published = null;
+ public $published = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'stockroom', 'stockroom_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'stockroom', 'stockroom_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/subattribute_property.php b/component/admin/tables/subattribute_property.php
index 4367e268335..02e793f9a3b 100755
--- a/component/admin/tables/subattribute_property.php
+++ b/component/admin/tables/subattribute_property.php
@@ -11,48 +11,47 @@
class Tablesubattribute_property extends JTable
{
- public $subattribute_color_id = null;
+ public $subattribute_color_id = null;
- public $subattribute_color_name = null;
+ public $subattribute_color_name = null;
- public $subattribute_color_title = null;
+ public $subattribute_color_title = null;
- public $subattribute_color_price = null;
+ public $subattribute_color_price = null;
- public $oprand = null;
+ public $oprand = null;
- public $subattribute_color_image = null;
+ public $subattribute_color_image = null;
- public $subattribute_id = null;
+ public $subattribute_id = null;
- public $ordering = null;
+ public $ordering = null;
- public $subattribute_color_number = null;
+ public $subattribute_color_number = null;
- public $setdefault_selected = 0;
+ public $setdefault_selected = 0;
- public $subattribute_color_main_image = null;
+ public $subattribute_color_main_image = null;
- public $subattribute_published = 1;
+ public $subattribute_published = 1;
- public $extra_field = null;
+ public $extra_field = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_subattribute_color', 'subattribute_color_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_subattribute_color', 'subattribute_color_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/supplier.php b/component/admin/tables/supplier.php
index 437f0df1e77..a49228b88f5 100644
--- a/component/admin/tables/supplier.php
+++ b/component/admin/tables/supplier.php
@@ -18,28 +18,27 @@
*/
class RedshopTableSupplier extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_supplier';
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_supplier';
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (empty($this->name))
- {
- return false;
- }
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (empty($this->name)) {
+ return false;
+ }
- return parent::doCheck();
- }
+ return parent::doCheck();
+ }
}
diff --git a/component/admin/tables/tax_group.php b/component/admin/tables/tax_group.php
index 7d01b511c30..87e55960fc1 100644
--- a/component/admin/tables/tax_group.php
+++ b/component/admin/tables/tax_group.php
@@ -18,48 +18,46 @@
*/
class RedshopTableTax_Group extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_tax_group';
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_tax_group';
- /**
- * Delete one or more registers
- *
- * @param string/array $pk Array of ids or ids comma separated
- *
- * @return boolean Deleted successful?
- */
- protected function doDelete($pk = null)
- {
- // Check tax rates
- if (RedshopEntityTax_Group::getInstance($this->id)->getTaxRates()->count() > 0)
- {
- $this->setError(JText::sprintf('COM_REDSHOP_TAX_GROUP_ERROR_DELETE_HAVE_TAX_RATE', $this->name));
+ /**
+ * Delete one or more registers
+ *
+ * @param string/array $pk Array of ids or ids comma separated
+ *
+ * @return boolean Deleted successful?
+ */
+ protected function doDelete($pk = null)
+ {
+ // Check tax rates
+ if (RedshopEntityTax_Group::getInstance($this->id)->getTaxRates()->count() > 0) {
+ $this->setError(JText::sprintf('COM_REDSHOP_TAX_GROUP_ERROR_DELETE_HAVE_TAX_RATE', $this->name));
- return false;
- }
+ return false;
+ }
- return parent::doDelete($pk);
- }
+ return parent::doDelete($pk);
+ }
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (empty($this->name))
- {
- return false;
- }
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (empty($this->name)) {
+ return false;
+ }
- return parent::doCheck();
- }
+ return parent::doCheck();
+ }
}
diff --git a/component/admin/tables/tax_rate.php b/component/admin/tables/tax_rate.php
index 494066f1bed..571e8a38c10 100644
--- a/component/admin/tables/tax_rate.php
+++ b/component/admin/tables/tax_rate.php
@@ -18,45 +18,41 @@
*/
class RedshopTableTax_Rate extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_tax_rate';
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (empty($this->name))
- {
- return false;
- }
-
- if (empty($this->tax_group_id))
- {
- return false;
- }
-
- if (!parent::doCheck())
- {
- return false;
- }
-
- if ($this->tax_rate < 0)
- {
- $this->setError(JText::_('COM_REDSHOP_TAX_RATE_INVALID_INPUT_MSG'));
-
- return false;
- }
-
- return true;
- }
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_tax_rate';
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (empty($this->name)) {
+ return false;
+ }
+
+ if (empty($this->tax_group_id)) {
+ return false;
+ }
+
+ if (!parent::doCheck()) {
+ return false;
+ }
+
+ if ($this->tax_rate < 0) {
+ $this->setError(JText::_('COM_REDSHOP_TAX_RATE_INVALID_INPUT_MSG'));
+
+ return false;
+ }
+
+ return true;
+ }
}
diff --git a/component/admin/tables/template.php b/component/admin/tables/template.php
index 2d8e2dbaebd..f038a4a816c 100644
--- a/component/admin/tables/template.php
+++ b/component/admin/tables/template.php
@@ -18,238 +18,212 @@
*/
class RedshopTableTemplate extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_template';
-
- /**
- * Temporary variable for store/load template content;
- *
- * @var string
- */
- public $templateDesc;
-
- /**
- * @var integer
- */
- public $id;
-
- /**
- * @var string
- */
- public $file_name;
-
- /**
- * @var string
- */
- public $name;
-
- /**
- * @var string
- */
- public $section;
-
- /**
- * Method to load a row from the database by primary key and bind the fields
- * to the JTable instance properties.
- *
- * @param mixed $keys An optional primary key value to load the row by, or an array of fields to match. If not
- * set the instance property value is used.
- * @param boolean $reset True to reset the default values before loading the new row.
- *
- * @return boolean True if successful. False if row not found.
- */
- protected function doLoad($keys = null, $reset = true)
- {
- if (!parent::doLoad($keys, $reset))
- {
- return false;
- }
-
- if ($this->id && !empty($this->file_name))
- {
- $file = JPath::clean(JPATH_REDSHOP_TEMPLATE . '/' . $this->section . '/' . $this->file_name . '.php');
-
- if (JFile::exists($file))
- {
- $this->templateDesc = (string) file_get_contents($file);
- }
- }
-
- return true;
- }
-
- /**
- * Method to bind an associative array or object to the JTable instance.This
- * method only binds properties that are publicly accessible and optionally
- * takes an array of properties to ignore when binding.
- *
- * @param mixed $src An associative array or object to bind to the JTable instance.
- * @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
- *
- * @return boolean True on success.
- *
- * @throws InvalidArgumentException
- */
- protected function doBind(&$src, $ignore = array())
- {
- if (!empty($src['order_status']) && !is_array($src['order_status']))
- {
- $src['order_status'] = explode(',', $src['order_status']);
- }
- else
- {
- unset($src['order_status']);
- $this->order_status = '';
- }
-
- if (!empty($src['payment_methods']) && !is_array($src['payment_methods']))
- {
- $src['payment_methods'] = explode(',', $src['payment_methods']);
- }
- else
- {
- unset($src['payment_methods']);
- $this->payment_methods = '';
- }
-
- if (!empty($src['shipping_methods']) && !is_array($src['shipping_methods']))
- {
- $src['shipping_methods'] = explode(',', $src['shipping_methods']);
- }
- else
- {
- unset($src['shipping_methods']);
- $this->shipping_methods = '';
- }
-
- return parent::doBind($src, $ignore);
- }
-
- /**
- * Do the database store.
- *
- * @param boolean $updateNulls True to update null values as well.
- *
- * @return boolean
- *
- * @throws Exception
- */
- protected function doStore($updateNulls = false)
- {
- if (!empty($this->payment_methods) && is_array($this->payment_methods))
- {
- $this->payment_methods = implode(',', $this->payment_methods);
- }
-
- if (!empty($this->shipping_methods) && is_array($this->shipping_methods))
- {
- $this->shipping_methods = implode(',', $this->shipping_methods);
- }
-
- if (!empty($this->order_status) && is_array($this->order_status))
- {
- $this->order_status = implode(',', $this->order_status);
- }
-
- $isNew = !$this->id;
-
- $this->setOption('content', $this->templateDesc);
- unset($this->templateDesc);
-
- if (!parent::doStore($updateNulls))
- {
- return false;
- }
-
- if ($isNew || empty($this->file_name))
- {
- $fileName = $this->generateTemplateFileName($this->id, $this->name);
-
- $db = $this->getDbo();
- $query = $db->getQuery(true)
- ->update($db->qn('#__redshop_template'))
- ->where($db->qn('id') . ' = ' . $this->id)
- ->set($db->qn('file_name') . ' = ' . $db->quote($fileName));
- $db->setQuery($query)->execute();
- }
- else
- {
- $fileName = $this->file_name;
- }
-
- // Write template file
- JFile::write(
- JPath::clean(JPATH_REDSHOP_TEMPLATE . '/' . $this->section . '/' . $fileName . '.php'),
- $this->getOption('content', '')
- );
-
- return true;
- }
-
- /**
- * Delete one or more registers
- *
- * @param string /array $pk Array of ids or ids comma separated
- *
- * @return boolean Deleted successfully?
- */
- protected function doDelete($pk = null)
- {
- if (!parent::doDelete($pk))
- {
- return false;
- }
-
- $templatePath = JPath::clean(JPATH_REDSHOP_TEMPLATE . '/' . $this->section . '/' . $this->file_name . '.php');
-
- if (JFile::exists($templatePath))
- {
- return JFile::delete($templatePath);
- }
-
- return true;
- }
-
- /**
- * Method for make template name safe
- *
- * @param integer $id Template ID
- * @param string $name Template name
- *
- * @return string
- *
- * @since 2.0.7
- */
- public function generateTemplateFileName($id = 0, $name = '')
- {
- return str_replace('-', '_', JFilterOutput::stringURLSafe($id . ' - ' . strtolower($name)));
- }
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (empty($this->name))
- {
- return false;
- }
-
- if (empty($this->section))
- {
- /** @scrutinizer ignore-deprecated */ $this->setError(JText::_('COM_REDSHOP_TEMPLATE_ERROR_SELECT_SECTION'));
- return false;
- }
-
- return parent::doCheck();
- }
+ /**
+ * Temporary variable for store/load template content;
+ *
+ * @var string
+ */
+ public $templateDesc;
+ /**
+ * @var integer
+ */
+ public $id;
+ /**
+ * @var string
+ */
+ public $file_name;
+ /**
+ * @var string
+ */
+ public $name;
+ /**
+ * @var string
+ */
+ public $section;
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_template';
+
+ /**
+ * Method to load a row from the database by primary key and bind the fields
+ * to the JTable instance properties.
+ *
+ * @param mixed $keys An optional primary key value to load the row by, or an array of fields to match. If not
+ * set the instance property value is used.
+ * @param boolean $reset True to reset the default values before loading the new row.
+ *
+ * @return boolean True if successful. False if row not found.
+ */
+ protected function doLoad($keys = null, $reset = true)
+ {
+ if (!parent::doLoad($keys, $reset)) {
+ return false;
+ }
+
+ if ($this->id && !empty($this->file_name)) {
+ $file = JPath::clean(JPATH_REDSHOP_TEMPLATE . '/' . $this->section . '/' . $this->file_name . '.php');
+
+ if (JFile::exists($file)) {
+ $this->templateDesc = (string)file_get_contents($file);
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Method to bind an associative array or object to the JTable instance.This
+ * method only binds properties that are publicly accessible and optionally
+ * takes an array of properties to ignore when binding.
+ *
+ * @param mixed $src An associative array or object to bind to the JTable instance.
+ * @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
+ *
+ * @return boolean True on success.
+ *
+ * @throws InvalidArgumentException
+ */
+ protected function doBind(&$src, $ignore = array())
+ {
+ if (!empty($src['order_status']) && !is_array($src['order_status'])) {
+ $src['order_status'] = explode(',', $src['order_status']);
+ } else {
+ unset($src['order_status']);
+ $this->order_status = '';
+ }
+
+ if (!empty($src['payment_methods']) && !is_array($src['payment_methods'])) {
+ $src['payment_methods'] = explode(',', $src['payment_methods']);
+ } else {
+ unset($src['payment_methods']);
+ $this->payment_methods = '';
+ }
+
+ if (!empty($src['shipping_methods']) && !is_array($src['shipping_methods'])) {
+ $src['shipping_methods'] = explode(',', $src['shipping_methods']);
+ } else {
+ unset($src['shipping_methods']);
+ $this->shipping_methods = '';
+ }
+
+ return parent::doBind($src, $ignore);
+ }
+
+ /**
+ * Do the database store.
+ *
+ * @param boolean $updateNulls True to update null values as well.
+ *
+ * @return boolean
+ *
+ * @throws Exception
+ */
+ protected function doStore($updateNulls = false)
+ {
+ if (!empty($this->payment_methods) && is_array($this->payment_methods)) {
+ $this->payment_methods = implode(',', $this->payment_methods);
+ }
+
+ if (!empty($this->shipping_methods) && is_array($this->shipping_methods)) {
+ $this->shipping_methods = implode(',', $this->shipping_methods);
+ }
+
+ if (!empty($this->order_status) && is_array($this->order_status)) {
+ $this->order_status = implode(',', $this->order_status);
+ }
+
+ $isNew = !$this->id;
+
+ $this->setOption('content', $this->templateDesc);
+ unset($this->templateDesc);
+
+ if (!parent::doStore($updateNulls)) {
+ return false;
+ }
+
+ if ($isNew || empty($this->file_name)) {
+ $fileName = $this->generateTemplateFileName($this->id, $this->name);
+
+ $db = $this->getDbo();
+ $query = $db->getQuery(true)
+ ->update($db->qn('#__redshop_template'))
+ ->where($db->qn('id') . ' = ' . $this->id)
+ ->set($db->qn('file_name') . ' = ' . $db->quote($fileName));
+ $db->setQuery($query)->execute();
+ } else {
+ $fileName = $this->file_name;
+ }
+
+ // Write template file
+ JFile::write(
+ JPath::clean(JPATH_REDSHOP_TEMPLATE . '/' . $this->section . '/' . $fileName . '.php'),
+ $this->getOption('content', '')
+ );
+
+ return true;
+ }
+
+ /**
+ * Method for make template name safe
+ *
+ * @param integer $id Template ID
+ * @param string $name Template name
+ *
+ * @return string
+ *
+ * @since 2.0.7
+ */
+ public function generateTemplateFileName($id = 0, $name = '')
+ {
+ return str_replace('-', '_', JFilterOutput::stringURLSafe($id . ' - ' . strtolower($name)));
+ }
+
+ /**
+ * Delete one or more registers
+ *
+ * @param string /array $pk Array of ids or ids comma separated
+ *
+ * @return boolean Deleted successfully?
+ */
+ protected function doDelete($pk = null)
+ {
+ if (!parent::doDelete($pk)) {
+ return false;
+ }
+
+ $templatePath = JPath::clean(JPATH_REDSHOP_TEMPLATE . '/' . $this->section . '/' . $this->file_name . '.php');
+
+ if (JFile::exists($templatePath)) {
+ return JFile::delete($templatePath);
+ }
+
+ return true;
+ }
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (empty($this->name)) {
+ return false;
+ }
+
+ if (empty($this->section)) {
+ /** @scrutinizer ignore-deprecated */
+ $this->setError(JText::_('COM_REDSHOP_TEMPLATE_ERROR_SELECT_SECTION'));
+
+ return false;
+ }
+
+ return parent::doCheck();
+ }
}
diff --git a/component/admin/tables/text.php b/component/admin/tables/text.php
index ccba85d8ffa..178c256d10d 100644
--- a/component/admin/tables/text.php
+++ b/component/admin/tables/text.php
@@ -18,51 +18,45 @@
*/
class RedshopTableText extends RedshopTable
{
- /**
- * @var string
- */
- protected $_tableName = 'redshop_textlibrary';
-
- /**
- * @var string
- */
- public $name;
-
- /**
- * @var string
- */
- public $desc;
-
- /**
- * @var string
- */
- public $section = 'product';
-
- /**
- * @var integer
- */
- public $published = 1;
-
- /**
- * @var string
- */
- public $content;
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (empty($this->name))
- {
- return false;
- }
-
- return parent::doCheck();
- }
+ /**
+ * @var string
+ */
+ public $name;
+ /**
+ * @var string
+ */
+ public $desc;
+ /**
+ * @var string
+ */
+ public $section = 'product';
+ /**
+ * @var integer
+ */
+ public $published = 1;
+ /**
+ * @var string
+ */
+ public $content;
+ /**
+ * @var string
+ */
+ protected $_tableName = 'redshop_textlibrary';
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (empty($this->name)) {
+ return false;
+ }
+
+ return parent::doCheck();
+ }
}
diff --git a/component/admin/tables/transaction_coupon_detail.php b/component/admin/tables/transaction_coupon_detail.php
index 0c2eda0369f..4bcf9a90e3a 100644
--- a/component/admin/tables/transaction_coupon_detail.php
+++ b/component/admin/tables/transaction_coupon_detail.php
@@ -11,36 +11,35 @@
class Tabletransaction_coupon_detail extends JTable
{
- public $transaction_coupon_id = null;
+ public $transaction_coupon_id = null;
- public $coupon_id = null;
+ public $coupon_id = null;
- public $coupon_code = null;
+ public $coupon_code = null;
- public $coupon_value = null;
+ public $coupon_value = null;
- public $userid = null;
+ public $userid = null;
- public $trancation_date = null;
+ public $trancation_date = null;
- public $published = null;
+ public $published = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'coupons_transaction', 'transaction_coupon_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'coupons_transaction', 'transaction_coupon_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/transaction_voucher_detail.php b/component/admin/tables/transaction_voucher_detail.php
index 9d9633b167b..4e921cc2049 100644
--- a/component/admin/tables/transaction_voucher_detail.php
+++ b/component/admin/tables/transaction_voucher_detail.php
@@ -11,40 +11,39 @@
class Tabletransaction_voucher_detail extends JTable
{
- public $transaction_voucher_id = null;
+ public $transaction_voucher_id = null;
- public $voucher_id = null;
+ public $voucher_id = null;
- public $voucher_code = null;
+ public $voucher_code = null;
- public $amount = null;
+ public $amount = null;
- public $user_id = null;
+ public $user_id = null;
- public $order_id = null;
+ public $order_id = null;
- public $trancation_date = null;
+ public $trancation_date = null;
- public $product_id = null;
+ public $product_id = null;
- public $published = null;
+ public $published = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'product_voucher_transaction', 'transaction_voucher_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'product_voucher_transaction', 'transaction_voucher_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/user_detail.php b/component/admin/tables/user_detail.php
index f1ad18ab601..13254939ef3 100644
--- a/component/admin/tables/user_detail.php
+++ b/component/admin/tables/user_detail.php
@@ -11,70 +11,69 @@
class Tableuser_detail extends JTable
{
- public $users_info_id = null;
+ public $users_info_id = null;
- public $user_email = null;
+ public $user_email = null;
- public $user_id = null;
+ public $user_id = null;
- public $firstname = null;
+ public $firstname = null;
- public $address_type = null;
+ public $address_type = null;
- public $lastname = null;
+ public $lastname = null;
- public $company_name = null;
+ public $company_name = null;
- public $vat_number = null;
+ public $vat_number = null;
- public $requesting_tax_exempt = null;
+ public $requesting_tax_exempt = null;
- public $tax_exempt = 0;
+ public $tax_exempt = 0;
- public $shopper_group_id = null;
+ public $shopper_group_id = null;
- public $isCompany = null;
+ public $isCompany = null;
- public $address = 0;
+ public $address = 0;
- public $city = 0;
+ public $city = 0;
- public $country_code = null;
+ public $country_code = null;
- public $state_code = null;
+ public $state_code = null;
- public $zipcode = 0;
+ public $zipcode = 0;
- public $phone = 0;
+ public $phone = 0;
- public $tax_exempt_approved = 0;
+ public $tax_exempt_approved = 0;
- public $approved = 0;
+ public $approved = 0;
- public $ean_number = null;
+ public $ean_number = null;
- public $accept_terms_conditions = 0;
+ public $accept_terms_conditions = 0;
- public $veis_vat_number = null;
+ public $veis_vat_number = null;
- public $veis_status = null;
+ public $veis_status = null;
- public function __construct(& $db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'users_info', 'users_info_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'users_info', 'users_info_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/usercart.php b/component/admin/tables/usercart.php
index a41145f637c..98a21ac7878 100644
--- a/component/admin/tables/usercart.php
+++ b/component/admin/tables/usercart.php
@@ -18,37 +18,32 @@
*/
class RedshopTableUsercart extends \Redshop\Table\AbstractTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_usercart';
-
- /**
- * The table key column. Usually: id
- *
- * @var string
- */
- protected $_tableKey = 'cart_id';
-
- /**
- * @var integer
- */
- public $cart_id = 0;
-
- /**
- * @var integer
- */
- public $user_id = 0;
-
- /**
- * @var integer
- */
- public $cdate = 0;
-
- /**
- * @var integer
- */
- public $mdate = 0;
+ /**
+ * @var integer
+ */
+ public $cart_id = 0;
+ /**
+ * @var integer
+ */
+ public $user_id = 0;
+ /**
+ * @var integer
+ */
+ public $cdate = 0;
+ /**
+ * @var integer
+ */
+ public $mdate = 0;
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_usercart';
+ /**
+ * The table key column. Usually: id
+ *
+ * @var string
+ */
+ protected $_tableKey = 'cart_id';
}
diff --git a/component/admin/tables/usercart_accessory_item.php b/component/admin/tables/usercart_accessory_item.php
index 98ea01d7a70..8e589206c72 100644
--- a/component/admin/tables/usercart_accessory_item.php
+++ b/component/admin/tables/usercart_accessory_item.php
@@ -18,37 +18,32 @@
*/
class RedshopTableUsercart_Accessory_Item extends \Redshop\Table\AbstractTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_usercart_accessory_item';
-
- /**
- * The table key column. Usually: id
- *
- * @var string
- */
- protected $_tableKey = 'cart_acc_item_id';
-
- /**
- * @var integer
- */
- public $cart_acc_item_id = 0;
-
- /**
- * @var integer
- */
- public $cart_item_id = 0;
-
- /**
- * @var integer
- */
- public $accessoryId = 0;
-
- /**
- * @var integer
- */
- public $accessory_quantity = 0;
+ /**
+ * @var integer
+ */
+ public $cart_acc_item_id = 0;
+ /**
+ * @var integer
+ */
+ public $cart_item_id = 0;
+ /**
+ * @var integer
+ */
+ public $accessoryId = 0;
+ /**
+ * @var integer
+ */
+ public $accessory_quantity = 0;
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_usercart_accessory_item';
+ /**
+ * The table key column. Usually: id
+ *
+ * @var string
+ */
+ protected $_tableKey = 'cart_acc_item_id';
}
diff --git a/component/admin/tables/usercart_attribute_item.php b/component/admin/tables/usercart_attribute_item.php
index 0a3dc3720d7..6b178b0544a 100644
--- a/component/admin/tables/usercart_attribute_item.php
+++ b/component/admin/tables/usercart_attribute_item.php
@@ -18,47 +18,40 @@
*/
class RedshopTableUsercart_Attribute_Item extends \Redshop\Table\AbstractTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_usercart_attribute_item';
-
- /**
- * The table key column. Usually: id
- *
- * @var string
- */
- protected $_tableKey = 'cart_att_item_id';
-
- /**
- * @var integer
- */
- public $cart_att_item_id = 0;
-
- /**
- * @var integer
- */
- public $cart_item_id = 0;
-
- /**
- * @var integer
- */
- public $section_id = 0;
-
- /**
- * @var string
- */
- public $section = null;
-
- /**
- * @var integer
- */
- public $parent_section_id = 0;
-
- /**
- * @var integer
- */
- public $is_accessory_att = 0;
+ /**
+ * @var integer
+ */
+ public $cart_att_item_id = 0;
+ /**
+ * @var integer
+ */
+ public $cart_item_id = 0;
+ /**
+ * @var integer
+ */
+ public $section_id = 0;
+ /**
+ * @var string
+ */
+ public $section = null;
+ /**
+ * @var integer
+ */
+ public $parent_section_id = 0;
+ /**
+ * @var integer
+ */
+ public $is_accessory_att = 0;
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_usercart_attribute_item';
+ /**
+ * The table key column. Usually: id
+ *
+ * @var string
+ */
+ protected $_tableKey = 'cart_att_item_id';
}
diff --git a/component/admin/tables/usercart_item.php b/component/admin/tables/usercart_item.php
index a771f6ff125..21b26dd0b5f 100644
--- a/component/admin/tables/usercart_item.php
+++ b/component/admin/tables/usercart_item.php
@@ -18,62 +18,52 @@
*/
class RedshopTableUsercart_Item extends \Redshop\Table\AbstractTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_usercart_item';
-
- /**
- * The table key column. Usually: id
- *
- * @var string
- */
- protected $_tableKey = 'cart_item_id';
-
- /**
- * @var integer
- */
- public $cart_item_id = 0;
-
- /**
- * @var integer
- */
- public $cart_idx = 0;
-
- /**
- * @var integer
- */
- public $cart_id = 0;
-
- /**
- * @var integer
- */
- public $product_id = 0;
-
- /**
- * @var integer
- */
- public $product_quantity = 0;
-
- /**
- * @var integer
- */
- public $product_wrapper_id = 0;
-
- /**
- * @var integer
- */
- public $product_subscription_id = 0;
-
- /**
- * @var integer
- */
- public $giftcard_id = 0;
-
- /**
- * @var string
- */
- public $attribs = '';
+ /**
+ * @var integer
+ */
+ public $cart_item_id = 0;
+ /**
+ * @var integer
+ */
+ public $cart_idx = 0;
+ /**
+ * @var integer
+ */
+ public $cart_id = 0;
+ /**
+ * @var integer
+ */
+ public $product_id = 0;
+ /**
+ * @var integer
+ */
+ public $product_quantity = 0;
+ /**
+ * @var integer
+ */
+ public $product_wrapper_id = 0;
+ /**
+ * @var integer
+ */
+ public $product_subscription_id = 0;
+ /**
+ * @var integer
+ */
+ public $giftcard_id = 0;
+ /**
+ * @var string
+ */
+ public $attribs = '';
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_usercart_item';
+ /**
+ * The table key column. Usually: id
+ *
+ * @var string
+ */
+ protected $_tableKey = 'cart_item_id';
}
diff --git a/component/admin/tables/voucher.php b/component/admin/tables/voucher.php
index 6e19be3a8ec..cfcfe41099b 100644
--- a/component/admin/tables/voucher.php
+++ b/component/admin/tables/voucher.php
@@ -18,184 +18,170 @@
*/
class RedshopTableVoucher extends RedshopTable
{
- /**
- * The table name without the prefix. Ex: cursos_courses
- *
- * @var string
- */
- protected $_tableName = 'redshop_voucher';
-
- /**
- * @var integer
- */
- public $id;
-
- /**
- * @var string
- */
- public $code;
-
- /**
- * @var float
- */
- public $amount;
-
- /**
- * @var string
- */
- public $type;
-
- /**
- * @var string
- */
- public $start_date = '0000-00-00 00:00:00';
-
- /**
- * @var string
- */
- public $end_date = '0000-00-00 00:00:00';
-
- /**
- * @var integer
- */
- public $free_ship;
-
- /**
- * @var integer
- */
- public $voucher_left;
-
- /**
- * @var integer
- */
- public $published;
-
- /**
- * Checks that the object is valid and able to be stored.
- *
- * This method checks that the parent_id is non-zero and exists in the database.
- * Note that the root node (parent_id = 0) cannot be manipulated with this class.
- *
- * @return boolean True if all checks pass.
- */
- protected function doCheck()
- {
- if (!parent::doCheck())
- {
- return false;
- }
-
- $db = $this->getDbo();
-
- // Check duplicate.
- $code = $this->get('code');
-
- $voucherQuery = $db->getQuery(true)
- ->select($db->qn('code'))
- ->from($db->qn('#__redshop_voucher'));
-
- if ($this->hasPrimaryKey())
- {
- $voucherQuery->where($db->qn('id') . ' <> ' . $this->id);
- }
-
- $couponQuery = $db->getQuery(true)
- ->select($db->qn('code'))
- ->from($db->qn('#__redshop_coupons'));
- $couponQuery->union($voucherQuery);
-
- $query = $db->getQuery(true)
- ->select('COUNT(*)')
- ->from('(' . $couponQuery . ') AS ' . $db->qn('data'))
- ->where($db->qn('data.code') . ' = ' . $db->quote($code));
-
- if ($db->setQuery($query)->loadResult())
- {
- $this->setError(JText::_('COM_REDSHOP_VOUCHER_ERROR_CODE_ALREADY_EXIST'));
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Method to bind an associative array or object to the JTable instance.This
- * method only binds properties that are publicly accessible and optionally
- * takes an array of properties to ignore when binding.
- *
- * @param mixed $src An associative array or object to bind to the JTable instance.
- * @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
- *
- * @return boolean True on success.
- *
- * @throws Exception
- */
- protected function doBind(&$src, $ignore = array())
- {
- if (isset($src['voucher_products']) && !empty($src['voucher_products']))
- {
- $products = is_string($src['voucher_products']) ? explode(',', $src['voucher_products']) : $src['voucher_products'];
- $this->setOption('products', $products);
- unset($src['shopper_group']);
- }
-
- return parent::doBind($src, $ignore);
- }
-
- /**
- * Do the database store.
- *
- * @param boolean $updateNulls True to update null values as well.
- *
- * @return boolean
- */
- protected function doStore($updateNulls = false)
- {
- if (!parent::doStore($updateNulls))
- {
- return false;
- }
-
- if ($this->getOption('skip.updateProducts', false) === true || $this->getOption('inlineMode', false) === true)
- {
- return true;
- }
-
- return $this->updateProduct();
- }
-
- /**
- * Method for update product xref.
- *
- * @return boolean
- */
- protected function updateProduct()
- {
- $db = $this->getDbo();
-
- // Clear current reference products.
- $query = $db->getQuery(true)
- ->delete($db->qn('#__redshop_product_voucher_xref'))
- ->where($db->qn('voucher_id') . ' = ' . $this->id);
- $db->setQuery($query)->execute();
-
- $products = $this->getOption('products', null);
-
- if (empty(array_filter($products)))
- {
- return true;
- }
-
- $query->clear()
- ->insert($db->qn('#__redshop_product_voucher_xref'))
- ->columns($db->qn(array('voucher_id', 'product_id')));
-
- foreach ($products as $productId)
- {
- $query->values((int) $this->id . ',' . (int) $productId);
- }
-
- return $db->setQuery($query)->execute();
- }
+ /**
+ * @var integer
+ */
+ public $id;
+ /**
+ * @var string
+ */
+ public $code;
+ /**
+ * @var float
+ */
+ public $amount;
+ /**
+ * @var string
+ */
+ public $type;
+ /**
+ * @var string
+ */
+ public $start_date = '0000-00-00 00:00:00';
+ /**
+ * @var string
+ */
+ public $end_date = '0000-00-00 00:00:00';
+ /**
+ * @var integer
+ */
+ public $free_ship;
+ /**
+ * @var integer
+ */
+ public $voucher_left;
+ /**
+ * @var integer
+ */
+ public $published;
+ /**
+ * The table name without the prefix. Ex: cursos_courses
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_voucher';
+
+ /**
+ * Checks that the object is valid and able to be stored.
+ *
+ * This method checks that the parent_id is non-zero and exists in the database.
+ * Note that the root node (parent_id = 0) cannot be manipulated with this class.
+ *
+ * @return boolean True if all checks pass.
+ */
+ protected function doCheck()
+ {
+ if (!parent::doCheck()) {
+ return false;
+ }
+
+ $db = $this->getDbo();
+
+ // Check duplicate.
+ $code = $this->get('code');
+
+ $voucherQuery = $db->getQuery(true)
+ ->select($db->qn('code'))
+ ->from($db->qn('#__redshop_voucher'));
+
+ if ($this->hasPrimaryKey()) {
+ $voucherQuery->where($db->qn('id') . ' <> ' . $this->id);
+ }
+
+ $couponQuery = $db->getQuery(true)
+ ->select($db->qn('code'))
+ ->from($db->qn('#__redshop_coupons'));
+ $couponQuery->union($voucherQuery);
+
+ $query = $db->getQuery(true)
+ ->select('COUNT(*)')
+ ->from('(' . $couponQuery . ') AS ' . $db->qn('data'))
+ ->where($db->qn('data.code') . ' = ' . $db->quote($code));
+
+ if ($db->setQuery($query)->loadResult()) {
+ $this->setError(JText::_('COM_REDSHOP_VOUCHER_ERROR_CODE_ALREADY_EXIST'));
+
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Method to bind an associative array or object to the JTable instance.This
+ * method only binds properties that are publicly accessible and optionally
+ * takes an array of properties to ignore when binding.
+ *
+ * @param mixed $src An associative array or object to bind to the JTable instance.
+ * @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
+ *
+ * @return boolean True on success.
+ *
+ * @throws Exception
+ */
+ protected function doBind(&$src, $ignore = array())
+ {
+ if (isset($src['voucher_products']) && !empty($src['voucher_products'])) {
+ $products = is_string($src['voucher_products']) ? explode(
+ ',',
+ $src['voucher_products']
+ ) : $src['voucher_products'];
+ $this->setOption('products', $products);
+ unset($src['shopper_group']);
+ }
+
+ return parent::doBind($src, $ignore);
+ }
+
+ /**
+ * Do the database store.
+ *
+ * @param boolean $updateNulls True to update null values as well.
+ *
+ * @return boolean
+ */
+ protected function doStore($updateNulls = false)
+ {
+ if (!parent::doStore($updateNulls)) {
+ return false;
+ }
+
+ if ($this->getOption('skip.updateProducts', false) === true || $this->getOption('inlineMode', false) === true) {
+ return true;
+ }
+
+ return $this->updateProduct();
+ }
+
+ /**
+ * Method for update product xref.
+ *
+ * @return boolean
+ */
+ protected function updateProduct()
+ {
+ $db = $this->getDbo();
+
+ // Clear current reference products.
+ $query = $db->getQuery(true)
+ ->delete($db->qn('#__redshop_product_voucher_xref'))
+ ->where($db->qn('voucher_id') . ' = ' . $this->id);
+ $db->setQuery($query)->execute();
+
+ $products = $this->getOption('products', null);
+
+ if (empty(array_filter($products))) {
+ return true;
+ }
+
+ $query->clear()
+ ->insert($db->qn('#__redshop_product_voucher_xref'))
+ ->columns($db->qn(array('voucher_id', 'product_id')));
+
+ foreach ($products as $productId) {
+ $query->values((int)$this->id . ',' . (int)$productId);
+ }
+
+ return $db->setQuery($query)->execute();
+ }
}
diff --git a/component/admin/tables/wishlist.php b/component/admin/tables/wishlist.php
index 97aa32ab93a..618477cf9b6 100644
--- a/component/admin/tables/wishlist.php
+++ b/component/admin/tables/wishlist.php
@@ -11,32 +11,31 @@
class Tablewishlist extends JTable
{
- public $wishlist_id = 0;
+ public $wishlist_id = 0;
- public $wishlist_name = null;
+ public $wishlist_name = null;
- public $user_id = null;
+ public $user_id = null;
- public $comment = null;
+ public $comment = null;
- public $cdate = null;
+ public $cdate = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'wishlist', 'wishlist_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'wishlist', 'wishlist_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/wishlist_product.php b/component/admin/tables/wishlist_product.php
index 77dad61c9f5..f6ee424f202 100644
--- a/component/admin/tables/wishlist_product.php
+++ b/component/admin/tables/wishlist_product.php
@@ -18,17 +18,17 @@
*/
class RedshopTableWishlist_Product extends RedshopTable
{
- /**
- * The table name without the prefix.
- *
- * @var string
- */
- protected $_tableName = 'redshop_wishlist_product';
+ /**
+ * The table name without the prefix.
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_wishlist_product';
- /**
- * The table key column. Usually: id
- *
- * @var string
- */
- protected $_tableKey = 'wishlist_product_id';
+ /**
+ * The table key column. Usually: id
+ *
+ * @var string
+ */
+ protected $_tableKey = 'wishlist_product_id';
}
diff --git a/component/admin/tables/wishlist_product_item.php b/component/admin/tables/wishlist_product_item.php
index 0efc5ac6568..5ba3ee7585e 100644
--- a/component/admin/tables/wishlist_product_item.php
+++ b/component/admin/tables/wishlist_product_item.php
@@ -18,10 +18,10 @@
*/
class RedshopTableWishlist_Product_Item extends RedshopTable
{
- /**
- * The table name without the prefix.
- *
- * @var string
- */
- protected $_tableName = 'redshop_wishlist_product_item';
+ /**
+ * The table name without the prefix.
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_wishlist_product_item';
}
diff --git a/component/admin/tables/wrapper_detail.php b/component/admin/tables/wrapper_detail.php
index 82f8c4b3be6..e359acbb517 100644
--- a/component/admin/tables/wrapper_detail.php
+++ b/component/admin/tables/wrapper_detail.php
@@ -11,39 +11,38 @@
class Tablewrapper_detail extends JTable
{
- public $wrapper_id = 0;
+ public $wrapper_id = 0;
- public $product_id = null;
+ public $product_id = null;
- public $category_id = null;
+ public $category_id = null;
- public $wrapper_price = null;
+ public $wrapper_price = null;
- public $wrapper_name = null;
+ public $wrapper_name = null;
- public $wrapper_image = null;
+ public $wrapper_image = null;
- public $wrapper_use_to_all = 0;
+ public $wrapper_use_to_all = 0;
- public $published = 1;
+ public $published = 1;
- public $createdate = 0;
+ public $createdate = 0;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'wrapper', 'wrapper_id', $db);
- }
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
+ parent::__construct($this->_table_prefix . 'wrapper', 'wrapper_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/xmlexport_detail.php b/component/admin/tables/xmlexport_detail.php
index 5155608226d..fa48473ae57 100644
--- a/component/admin/tables/xmlexport_detail.php
+++ b/component/admin/tables/xmlexport_detail.php
@@ -11,70 +11,69 @@
class Tablexmlexport_detail extends JTable
{
- public $xmlexport_id = null;
+ public $xmlexport_id = null;
- public $filename = null;
+ public $filename = null;
- public $display_filename = null;
+ public $display_filename = null;
- public $parent_name = null;
+ public $parent_name = null;
- public $element_name = null;
+ public $element_name = null;
- public $section_type = null;
+ public $section_type = null;
- public $sync_on_request = 0;
+ public $sync_on_request = 0;
- public $auto_sync = 0;
+ public $auto_sync = 0;
- public $auto_sync_interval = 0;
+ public $auto_sync_interval = 0;
- public $xmlexport_date = null;
+ public $xmlexport_date = null;
- public $xmlexport_filetag = null;
+ public $xmlexport_filetag = null;
- public $xmlexport_billingtag = null;
+ public $xmlexport_billingtag = null;
- public $billing_element_name = null;
+ public $billing_element_name = null;
- public $xmlexport_shippingtag = null;
+ public $xmlexport_shippingtag = null;
- public $shipping_element_name = null;
+ public $shipping_element_name = null;
- public $xmlexport_orderitemtag = null;
+ public $xmlexport_orderitemtag = null;
- public $orderitem_element_name = null;
+ public $orderitem_element_name = null;
- public $xmlexport_stocktag = null;
+ public $xmlexport_stocktag = null;
- public $stock_element_name = null;
+ public $stock_element_name = null;
- public $xmlexport_prdextrafieldtag = null;
+ public $xmlexport_prdextrafieldtag = null;
- public $prdextrafield_element_name = null;
+ public $prdextrafield_element_name = null;
- public $published = 0;
+ public $published = 0;
- public $use_to_all_users = 1;
+ public $use_to_all_users = 1;
- public $xmlexport_on_category = null;
+ public $xmlexport_on_category = null;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'xml_export', 'xmlexport_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'xml_export', 'xmlexport_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/xmlimport_detail.php b/component/admin/tables/xmlimport_detail.php
index 121346bc0bc..84fa62b0ec5 100644
--- a/component/admin/tables/xmlimport_detail.php
+++ b/component/admin/tables/xmlimport_detail.php
@@ -11,70 +11,69 @@
class Tablexmlimport_detail extends JTable
{
- public $xmlimport_id = null;
+ public $xmlimport_id = null;
- public $filename = null;
+ public $filename = null;
- public $display_filename = null;
+ public $display_filename = null;
- public $xmlimport_url = null;
+ public $xmlimport_url = null;
- public $section_type = null;
+ public $section_type = null;
- public $sync_on_request = 0;
+ public $sync_on_request = 0;
- public $auto_sync = 0;
+ public $auto_sync = 0;
- public $auto_sync_interval = 0;
+ public $auto_sync_interval = 0;
- public $override_existing = 0;
+ public $override_existing = 0;
- public $add_prefix_for_existing = null;
+ public $add_prefix_for_existing = null;
- public $xmlimport_date = null;
+ public $xmlimport_date = null;
- public $xmlimport_filetag = null;
+ public $xmlimport_filetag = null;
- public $xmlimport_billingtag = null;
+ public $xmlimport_billingtag = null;
- public $xmlimport_shippingtag = null;
+ public $xmlimport_shippingtag = null;
- public $xmlimport_orderitemtag = null;
+ public $xmlimport_orderitemtag = null;
- public $xmlimport_stocktag = null;
+ public $xmlimport_stocktag = null;
- public $xmlimport_prdextrafieldtag = null;
+ public $xmlimport_prdextrafieldtag = null;
- public $element_name = null;
+ public $element_name = null;
- public $billing_element_name = null;
+ public $billing_element_name = null;
- public $shipping_element_name = null;
+ public $shipping_element_name = null;
- public $orderitem_element_name = null;
+ public $orderitem_element_name = null;
- public $stock_element_name = null;
+ public $stock_element_name = null;
- public $prdextrafield_element_name = null;
+ public $prdextrafield_element_name = null;
- public $published = 0;
+ public $published = 0;
- public function __construct(&$db)
- {
- $this->_table_prefix = '#__redshop_';
+ public function __construct(&$db)
+ {
+ $this->_table_prefix = '#__redshop_';
- parent::__construct($this->_table_prefix . 'xml_import', 'xmlimport_id', $db);
- }
+ parent::__construct($this->_table_prefix . 'xml_import', 'xmlimport_id', $db);
+ }
- public function bind($array, $ignore = '')
- {
- if (array_key_exists('params', $array) && is_array($array['params']))
- {
- $registry = new JRegistry;
- $registry->loadArray($array['params']);
- $array['params'] = $registry->toString();
- }
+ public function bind($array, $ignore = '')
+ {
+ if (array_key_exists('params', $array) && is_array($array['params'])) {
+ $registry = new JRegistry;
+ $registry->loadArray($array['params']);
+ $array['params'] = $registry->toString();
+ }
- return parent::bind($array, $ignore);
- }
+ return parent::bind($array, $ignore);
+ }
}
diff --git a/component/admin/tables/zipcode.php b/component/admin/tables/zipcode.php
index 49dbba3c489..15f3a09d46b 100644
--- a/component/admin/tables/zipcode.php
+++ b/component/admin/tables/zipcode.php
@@ -18,53 +18,46 @@
*/
class RedshopTableZipcode extends RedshopTable
{
- /**
- * The table name without prefix.
- *
- * @var string
- */
- protected $_tableName = 'redshop_zipcode';
-
- /**
- * The table key column
- *
- * @var string
- */
- protected $_tableKey = 'id';
-
- public $id = null;
-
- public $state_code = null;
-
- public $city_name = null;
-
- public $zipcode = null;
-
- public $country_code = null;
-
- /**
- * Check zipcode
- *
- * @return boolean
- */
- public function docheck()
- {
- $db = JFactory::getDbo();
-
- $query = $db->getQuery(true)
- ->select('id')
- ->from($db->qn("#__redshop_zipcode"))
- ->where($db->qn('zipcode') . ' = ' . $db->q((int) $this->zipcode))
- ->where($db->qn('id') . ' != ' . $db->q((int) $this->id))
- ->where($db->qn('country_code') . ' = ' . $db->q((string) $this->country_code));
-
- $xid = intval($db->setQuery($query)->loadResult());
-
- if ($xid)
- {
- return false;
- }
-
- return parent::doCheck();
- }
+ public $id = null;
+ public $state_code = null;
+ public $city_name = null;
+ public $zipcode = null;
+ public $country_code = null;
+ /**
+ * The table name without prefix.
+ *
+ * @var string
+ */
+ protected $_tableName = 'redshop_zipcode';
+ /**
+ * The table key column
+ *
+ * @var string
+ */
+ protected $_tableKey = 'id';
+
+ /**
+ * Check zipcode
+ *
+ * @return boolean
+ */
+ public function docheck()
+ {
+ $db = JFactory::getDbo();
+
+ $query = $db->getQuery(true)
+ ->select('id')
+ ->from($db->qn("#__redshop_zipcode"))
+ ->where($db->qn('zipcode') . ' = ' . $db->q((int)$this->zipcode))
+ ->where($db->qn('id') . ' != ' . $db->q((int)$this->id))
+ ->where($db->qn('country_code') . ' = ' . $db->q((string)$this->country_code));
+
+ $xid = intval($db->setQuery($query)->loadResult());
+
+ if ($xid) {
+ return false;
+ }
+
+ return parent::doCheck();
+ }
}
diff --git a/component/admin/updates/1.3.3.1.php b/component/admin/updates/1.3.3.1.php
index e69423f94f6..eb741b59f8a 100644
--- a/component/admin/updates/1.3.3.1.php
+++ b/component/admin/updates/1.3.3.1.php
@@ -18,46 +18,44 @@
*/
class RedshopUpdate1331 extends RedshopInstallUpdate
{
- /**
- * Method to update schema table if necessary.
- *
- * @return void
- *
- * @since 1.3.3.1
- */
- public function updateDatabaseSchema()
- {
- $db = JFactory::getDbo();
- $query = $db->getQuery(true)
- ->select($db->qn('extension_id'))
- ->from($db->qn('#__extensions'))
- ->where($db->qn('element') . ' = ' . $db->quote('com_redshop'))
- ->where($db->qn('type') . ' = ' . $db->quote('component'));
- $componentId = $db->setQuery($query)->loadResult();
+ /**
+ * Method to update schema table if necessary.
+ *
+ * @return void
+ *
+ * @since 1.3.3.1
+ */
+ public function updateDatabaseSchema()
+ {
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true)
+ ->select($db->qn('extension_id'))
+ ->from($db->qn('#__extensions'))
+ ->where($db->qn('element') . ' = ' . $db->quote('com_redshop'))
+ ->where($db->qn('type') . ' = ' . $db->quote('component'));
+ $componentId = $db->setQuery($query)->loadResult();
- // Skip if there are no redshop install
- if (!$componentId)
- {
- return;
- }
+ // Skip if there are no redshop install
+ if (!$componentId) {
+ return;
+ }
- $query->clear()
- ->select($db->qn('version_id'))
- ->from($db->qn('#__schemas'))
- ->where($db->qn('extension_id') . ' = ' . $componentId);
- $result = $db->setQuery($query)->loadResult();
+ $query->clear()
+ ->select($db->qn('version_id'))
+ ->from($db->qn('#__schemas'))
+ ->where($db->qn('extension_id') . ' = ' . $componentId);
+ $result = $db->setQuery($query)->loadResult();
- // Skip if there are already schema
- if ($result)
- {
- return;
- }
+ // Skip if there are already schema
+ if ($result) {
+ return;
+ }
- $query->clear()
- ->insert($db->qn('#__schemas'))
- ->columns($db->qn(array('extension_id', 'version_id')))
- ->values($componentId . ',' . $db->quote('1.1.10'));
+ $query->clear()
+ ->insert($db->qn('#__schemas'))
+ ->columns($db->qn(array('extension_id', 'version_id')))
+ ->values($componentId . ',' . $db->quote('1.1.10'));
- $db->setQuery($query)->execute();
- }
+ $db->setQuery($query)->execute();
+ }
}
diff --git a/component/admin/updates/1.6.0.php b/component/admin/updates/1.6.0.php
index e170c6baf02..07325bbfdd5 100644
--- a/component/admin/updates/1.6.0.php
+++ b/component/admin/updates/1.6.0.php
@@ -18,88 +18,88 @@
*/
class RedshopUpdate160 extends RedshopInstallUpdate
{
- /**
- * Return list of old files for clean
- *
- * @return array
- *
- * @since 1.6.0
- */
- protected function getOldFiles()
- {
- return array(
- JPATH_SITE . '/components/com_redshop/assets/download/product/.htaccess',
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/navigator_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/product_detail/tmpl/default_product_dropdown.php',
- JPATH_SITE . '/components/com_redshop/views/category/tmpl/searchletter.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/container.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/container_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/customprint.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/delivery.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/order_container.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/payment.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/payment_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/product_container.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/subinstall.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/container.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/container_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/order_container.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/payment.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/payment_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/product_container.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/container_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/payment_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/accessmanager/tmpl/noaccess.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/order/tmpl/multiprint_order.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/order/tmpl/previewlog.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/stockroom_detail/tmpl/default_product.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/assets/js/select_sort.js',
- JPATH_ADMINISTRATOR . '/components/com_redshop/assets/js/related.js',
- JPATH_ADMINISTRATOR . '/components/com_redshop/assets/js/container_search.js',
- JPATH_ADMINISTRATOR . '/components/com_redshop/assets/js/mootools.js',
- JPATH_ADMINISTRATOR . '/components/com_redshop/assets/images/redshop_white.png',
- JPATH_ADMINISTRATOR . '/components/com_redshop/assets/images/j_arrow.png',
- JPATH_ADMINISTRATOR . '/components/com_redshop/assets/images/j_arrow_down.png',
- JPATH_ADMINISTRATOR . '/components/com_redshop/assets/images/ui-icons_222222_256x240.png',
- JPATH_ADMINISTRATOR . '/components/com_redshop/assets/images/ui-icons_228ef1_256x240.png',
- JPATH_SITE . '/components/com_redshop/controllers/password.php',
- JPATH_SITE . '/components/com_redshop/controllers/price_filter.php',
- JPATH_SITE . '/components/com_redshop/helpers/class.img2thumb.php',
- JPATH_SITE . '/components/com_redshop/helpers/graph.php',
- JPATH_SITE . '/components/com_redshop/helpers/pagination.php',
- JPATH_SITE . '/components/com_redshop/helpers/thumb.php',
- JPATH_SITE . '/components/com_redshop/models/password.php',
- JPATH_SITE . '/components/com_redshop/views/price_filter/view.html.php',
- JPATH_SITE . '/components/com_redshop/views/product/tmpl/default_askquestion.php',
- JPATH_LIBRARIES . '/redshop/form/fields/rstext.php'
- );
- }
+ /**
+ * Return list of old files for clean
+ *
+ * @return array
+ *
+ * @since 1.6.0
+ */
+ protected function getOldFiles()
+ {
+ return array(
+ JPATH_SITE . '/components/com_redshop/assets/download/product/.htaccess',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/navigator_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/product_detail/tmpl/default_product_dropdown.php',
+ JPATH_SITE . '/components/com_redshop/views/category/tmpl/searchletter.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/container.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/container_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/customprint.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/delivery.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/order_container.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/payment.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/payment_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/product_container.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/subinstall.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/container.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/container_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/order_container.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/payment.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/payment_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/product_container.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/container_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/payment_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/accessmanager/tmpl/noaccess.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/order/tmpl/multiprint_order.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/order/tmpl/previewlog.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/stockroom_detail/tmpl/default_product.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/assets/js/select_sort.js',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/assets/js/related.js',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/assets/js/container_search.js',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/assets/js/mootools.js',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/assets/images/redshop_white.png',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/assets/images/j_arrow.png',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/assets/images/j_arrow_down.png',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/assets/images/ui-icons_222222_256x240.png',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/assets/images/ui-icons_228ef1_256x240.png',
+ JPATH_SITE . '/components/com_redshop/controllers/password.php',
+ JPATH_SITE . '/components/com_redshop/controllers/price_filter.php',
+ JPATH_SITE . '/components/com_redshop/helpers/class.img2thumb.php',
+ JPATH_SITE . '/components/com_redshop/helpers/graph.php',
+ JPATH_SITE . '/components/com_redshop/helpers/pagination.php',
+ JPATH_SITE . '/components/com_redshop/helpers/thumb.php',
+ JPATH_SITE . '/components/com_redshop/models/password.php',
+ JPATH_SITE . '/components/com_redshop/views/price_filter/view.html.php',
+ JPATH_SITE . '/components/com_redshop/views/product/tmpl/default_askquestion.php',
+ JPATH_LIBRARIES . '/redshop/form/fields/rstext.php'
+ );
+ }
- /**
- * Return list of old folders for clean
- *
- * @return array
- *
- * @since 1.6.0
- */
- protected function getOldFolders()
- {
- return array(
- JPATH_SITE . '/components/com_redshop/assets/js',
- JPATH_SITE . '/components/com_redshop/assets/css',
- JPATH_SITE . '/components/com_redshop/helpers/fonts',
- JPATH_SITE . '/components/com_redshop/helpers/tcpdf',
- JPATH_SITE . '/components/com_redshop/views/epayrelay',
- JPATH_SITE . '/components/com_redshop/views/password',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/adapters',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/container',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/container_detail',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/customprint',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/delivery',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/payment',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/payment_detail',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/product_container',
- JPATH_ADMINISTRATOR . '/components/com_redshop/layouts/system'
- );
- }
+ /**
+ * Return list of old folders for clean
+ *
+ * @return array
+ *
+ * @since 1.6.0
+ */
+ protected function getOldFolders()
+ {
+ return array(
+ JPATH_SITE . '/components/com_redshop/assets/js',
+ JPATH_SITE . '/components/com_redshop/assets/css',
+ JPATH_SITE . '/components/com_redshop/helpers/fonts',
+ JPATH_SITE . '/components/com_redshop/helpers/tcpdf',
+ JPATH_SITE . '/components/com_redshop/views/epayrelay',
+ JPATH_SITE . '/components/com_redshop/views/password',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/adapters',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/container',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/container_detail',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/customprint',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/delivery',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/payment',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/payment_detail',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/product_container',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/layouts/system'
+ );
+ }
}
diff --git a/component/admin/updates/2.0.0.2.php b/component/admin/updates/2.0.0.2.php
index 0830d3776ef..04cd7878c44 100644
--- a/component/admin/updates/2.0.0.2.php
+++ b/component/admin/updates/2.0.0.2.php
@@ -18,64 +18,64 @@
*/
class RedshopUpdate2002 extends RedshopInstallUpdate
{
- /**
- * Return list of old files for clean
- *
- * @return array
- *
- * @since 2.0.0.2
- */
- protected function getOldFiles()
- {
- return array(
- JPATH_SITE . '/components/com_redshop/helpers/helper.php',
- JPATH_SITE . '/components/com_redshop/helpers/currency.php',
- JPATH_SITE . '/components/com_redshop/helpers/product.php',
- JPATH_SITE . '/components/com_redshop/helpers/cart.php',
- JPATH_SITE . '/components/com_redshop/helpers/user.php',
- JPATH_SITE . '/components/com_redshop/views/search/tmpl/default.xml',
- JPATH_SITE . '/components/com_redshop/helpers/extra_field.php',
- JPATH_SITE . '/components/com_redshop/helpers/google_analytics.php',
- JPATH_SITE . '/components/com_redshop/helpers/googleanalytics.php',
- JPATH_SITE . '/components/com_redshop/helpers/zip.php',
- JPATH_SITE . '/components/com_redshop/helpers/cron.php',
- JPATH_SITE . '/components/com_redshop/helpers/redshop.js.php',
- JPATH_SITE . '/components/com_redshop/helpers/zipfile.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/answer.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/answer_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/answer.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/answer_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/access_level.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/category.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/configuration.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/images.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/mail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/media.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/order.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/quotation.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/stockroom.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/template.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/update.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/shopper.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/xmlcron.php',
- JPATH_LIBRARIES . '/redshop/form/fields/stockroom.php'
- );
- }
+ /**
+ * Return list of old files for clean
+ *
+ * @return array
+ *
+ * @since 2.0.0.2
+ */
+ protected function getOldFiles()
+ {
+ return array(
+ JPATH_SITE . '/components/com_redshop/helpers/helper.php',
+ JPATH_SITE . '/components/com_redshop/helpers/currency.php',
+ JPATH_SITE . '/components/com_redshop/helpers/product.php',
+ JPATH_SITE . '/components/com_redshop/helpers/cart.php',
+ JPATH_SITE . '/components/com_redshop/helpers/user.php',
+ JPATH_SITE . '/components/com_redshop/views/search/tmpl/default.xml',
+ JPATH_SITE . '/components/com_redshop/helpers/extra_field.php',
+ JPATH_SITE . '/components/com_redshop/helpers/google_analytics.php',
+ JPATH_SITE . '/components/com_redshop/helpers/googleanalytics.php',
+ JPATH_SITE . '/components/com_redshop/helpers/zip.php',
+ JPATH_SITE . '/components/com_redshop/helpers/cron.php',
+ JPATH_SITE . '/components/com_redshop/helpers/redshop.js.php',
+ JPATH_SITE . '/components/com_redshop/helpers/zipfile.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/answer.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/answer_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/answer.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/answer_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/access_level.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/category.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/configuration.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/images.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/mail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/media.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/order.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/quotation.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/stockroom.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/template.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/update.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/shopper.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/xmlcron.php',
+ JPATH_LIBRARIES . '/redshop/form/fields/stockroom.php'
+ );
+ }
- /**
- * Return list of old folders for clean
- *
- * @return array
- *
- * @since 2.0.0.2
- */
- protected function getOldFolders()
- {
- return array(
- JPATH_LIBRARIES . '/redshop/config',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/answer',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/answer_detail',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/barcode'
- );
- }
+ /**
+ * Return list of old folders for clean
+ *
+ * @return array
+ *
+ * @since 2.0.0.2
+ */
+ protected function getOldFolders()
+ {
+ return array(
+ JPATH_LIBRARIES . '/redshop/config',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/answer',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/answer_detail',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/barcode'
+ );
+ }
}
diff --git a/component/admin/updates/2.0.0.5.php b/component/admin/updates/2.0.0.5.php
index 9a083e732fd..adec89c8301 100644
--- a/component/admin/updates/2.0.0.5.php
+++ b/component/admin/updates/2.0.0.5.php
@@ -18,34 +18,34 @@
*/
class RedshopUpdate2005 extends RedshopInstallUpdate
{
- /**
- * Return list of old files for clean
- *
- * @return array
- *
- * @since 2.0.0.5
- */
- protected function getOldFiles()
- {
- return array(
- JPATH_ADMINISTRATOR . '/component/admin/controllers/question_detail.php',
- JPATH_ADMINISTRATOR . '/component/admin/models/question_detail.php',
- JPATH_ADMINISTRATOR . '/component/admin/tables/question_detail.php',
- JPATH_ADMINISTRATOR . '/component/admin/views/question/tmpl/default.php'
- );
- }
+ /**
+ * Return list of old files for clean
+ *
+ * @return array
+ *
+ * @since 2.0.0.5
+ */
+ protected function getOldFiles()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/component/admin/controllers/question_detail.php',
+ JPATH_ADMINISTRATOR . '/component/admin/models/question_detail.php',
+ JPATH_ADMINISTRATOR . '/component/admin/tables/question_detail.php',
+ JPATH_ADMINISTRATOR . '/component/admin/views/question/tmpl/default.php'
+ );
+ }
- /**
- * Return list of old folders for clean
- *
- * @return array
- *
- * @since 2.0.0.5
- */
- protected function getOldFolders()
- {
- return array(
- JPATH_ADMINISTRATOR . '/component/admin/views/question_detail'
- );
- }
+ /**
+ * Return list of old folders for clean
+ *
+ * @return array
+ *
+ * @since 2.0.0.5
+ */
+ protected function getOldFolders()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/component/admin/views/question_detail'
+ );
+ }
}
diff --git a/component/admin/updates/2.0.10.php b/component/admin/updates/2.0.10.php
index 6e1de757748..2ace83761b8 100644
--- a/component/admin/updates/2.0.10.php
+++ b/component/admin/updates/2.0.10.php
@@ -18,36 +18,36 @@
*/
class RedshopUpdate2010 extends RedshopInstallUpdate
{
- /**
- * Return list of old files for clean
- *
- * @return array
- *
- * @since 2.0.10
- */
- protected function getOldFiles()
- {
- return array(
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/discount_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/discount_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/discount_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/discount/tmpl/product.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/mass_discount/tmpl/product.php',
- JPATH_LIBRARIES . '/redshop/entity/product_discount.php'
- );
- }
+ /**
+ * Return list of old files for clean
+ *
+ * @return array
+ *
+ * @since 2.0.10
+ */
+ protected function getOldFiles()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/discount_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/discount_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/discount_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/discount/tmpl/product.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/mass_discount/tmpl/product.php',
+ JPATH_LIBRARIES . '/redshop/entity/product_discount.php'
+ );
+ }
- /**
- * Return list of old folders for clean
- *
- * @return array
- *
- * @since 2.0.10
- */
- protected function getOldFolders()
- {
- return array(
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/discount_detail'
- );
- }
+ /**
+ * Return list of old folders for clean
+ *
+ * @return array
+ *
+ * @since 2.0.10
+ */
+ protected function getOldFolders()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/discount_detail'
+ );
+ }
}
diff --git a/component/admin/updates/2.0.11.php b/component/admin/updates/2.0.11.php
index b425c97b880..c9e21f7d57a 100644
--- a/component/admin/updates/2.0.11.php
+++ b/component/admin/updates/2.0.11.php
@@ -18,34 +18,34 @@
*/
class RedshopUpdate2011 extends RedshopInstallUpdate
{
- /**
- * Return list of old files for clean
- *
- * @return array
- *
- * @since 2.0.11
- */
- protected function getOldFiles()
- {
- return array(
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/currency_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/currency_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/currency_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/currency/tmpl/default.php'
- );
- }
+ /**
+ * Return list of old files for clean
+ *
+ * @return array
+ *
+ * @since 2.0.11
+ */
+ protected function getOldFiles()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/currency_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/currency_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/currency_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/currency/tmpl/default.php'
+ );
+ }
- /**
- * Return list of old folders for clean
- *
- * @return array
- *
- * @since 2.0.11
- */
- protected function getOldFolders()
- {
- return array(
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/currency_detail'
- );
- }
+ /**
+ * Return list of old folders for clean
+ *
+ * @return array
+ *
+ * @since 2.0.11
+ */
+ protected function getOldFolders()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/currency_detail'
+ );
+ }
}
diff --git a/component/admin/updates/2.0.12.php b/component/admin/updates/2.0.12.php
index b065a77fa7c..a9d99421fa6 100644
--- a/component/admin/updates/2.0.12.php
+++ b/component/admin/updates/2.0.12.php
@@ -18,36 +18,36 @@
*/
class RedshopUpdate2012 extends RedshopInstallUpdate
{
- /**
- * Return list of old files for clean
- *
- * @return array
- *
- * @since 2.0.11
- */
- protected function getOldFiles()
- {
- return array(
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/textlibrary.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/textlibrary_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/textlibrary.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/textlibrary_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/textlibrary_detail.php'
- );
- }
+ /**
+ * Return list of old files for clean
+ *
+ * @return array
+ *
+ * @since 2.0.11
+ */
+ protected function getOldFiles()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/textlibrary.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/textlibrary_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/textlibrary.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/textlibrary_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/textlibrary_detail.php'
+ );
+ }
- /**
- * Return list of old folders for clean
- *
- * @return array
- *
- * @since 2.0.11
- */
- protected function getOldFolders()
- {
- return array(
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/textlibrary',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/textlibrary_detail'
- );
- }
+ /**
+ * Return list of old folders for clean
+ *
+ * @return array
+ *
+ * @since 2.0.11
+ */
+ protected function getOldFolders()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/textlibrary',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/textlibrary_detail'
+ );
+ }
}
diff --git a/component/admin/updates/2.0.13.php b/component/admin/updates/2.0.13.php
index b6139c93ee7..4b05aad6898 100644
--- a/component/admin/updates/2.0.13.php
+++ b/component/admin/updates/2.0.13.php
@@ -18,85 +18,78 @@
*/
class RedshopUpdate2013 extends RedshopInstallUpdate
{
- /**
- * Method for migrate manufacturer images.
- *
- * @return void
- * @throws Exception
- *
- * @since 2.0.13
- */
- public function migrateManufacturerImages()
- {
- $db = JFactory::getDbo();
-
- $query = $db->getQuery(true)
- ->select('*')
- ->from($db->qn('#__redshop_media'))
- ->where($db->qn('media_section') . ' = ' . $db->quote('manufacturer'))
- ->order($db->qn('section_id'));
-
- $medias = $db->setQuery($query)->loadObjectList();
-
- if (empty($medias))
- {
- return;
- }
-
- $newBasePath = REDSHOP_MEDIA_IMAGE_RELPATH . 'manufacturer';
- $oldBasePath = REDSHOP_FRONT_IMAGES_RELPATH . 'manufacturer';
-
- foreach ($medias as $media)
- {
- /** @var RedshopTableMedia $table */
- $table = RedshopTable::getAdminInstance('Media', array('ignore_request' => true), 'com_redshop');
-
- $table->bind((array) $media);
-
- // In case this media don't have media file. Delete this.
- if (empty($table->media_name))
- {
- $table->delete();
-
- continue;
- }
-
- // Prepare target folder.
- $path = $newBasePath . '/' . $table->section_id;
-
- if (!JFolder::exists($path))
- {
- JFolder::create($path);
- }
-
- // Copy index.html to this folder.
- if (!JFile::exists($path . '/index.html'))
- {
- JFile::copy(REDSHOP_MEDIA_IMAGE_RELPATH . 'index.html', $path . '/index.html');
- }
-
- // Check old image exist.
- $oldImagePath = $oldBasePath . '/' . $table->media_name;
-
- if (!JFile::exists($oldImagePath))
- {
- continue;
- }
-
- // Generate new image using MD5
- $newFileName = md5(basename($table->media_name)) . '.' . JFile::getExt($table->media_name);
-
- if (!JFile::copy($oldImagePath, $path . '/' . $newFileName))
- {
- continue;
- }
-
- // Update media data with new file name.
- $table->media_name = $newFileName;
- $table->store();
- }
-
- // Remove old folders
- JFolder::delete($oldBasePath);
- }
+ /**
+ * Method for migrate manufacturer images.
+ *
+ * @return void
+ * @throws Exception
+ *
+ * @since 2.0.13
+ */
+ public function migrateManufacturerImages()
+ {
+ $db = JFactory::getDbo();
+
+ $query = $db->getQuery(true)
+ ->select('*')
+ ->from($db->qn('#__redshop_media'))
+ ->where($db->qn('media_section') . ' = ' . $db->quote('manufacturer'))
+ ->order($db->qn('section_id'));
+
+ $medias = $db->setQuery($query)->loadObjectList();
+
+ if (empty($medias)) {
+ return;
+ }
+
+ $newBasePath = REDSHOP_MEDIA_IMAGE_RELPATH . 'manufacturer';
+ $oldBasePath = REDSHOP_FRONT_IMAGES_RELPATH . 'manufacturer';
+
+ foreach ($medias as $media) {
+ /** @var RedshopTableMedia $table */
+ $table = RedshopTable::getAdminInstance('Media', array('ignore_request' => true), 'com_redshop');
+
+ $table->bind((array)$media);
+
+ // In case this media don't have media file. Delete this.
+ if (empty($table->media_name)) {
+ $table->delete();
+
+ continue;
+ }
+
+ // Prepare target folder.
+ $path = $newBasePath . '/' . $table->section_id;
+
+ if (!JFolder::exists($path)) {
+ JFolder::create($path);
+ }
+
+ // Copy index.html to this folder.
+ if (!JFile::exists($path . '/index.html')) {
+ JFile::copy(REDSHOP_MEDIA_IMAGE_RELPATH . 'index.html', $path . '/index.html');
+ }
+
+ // Check old image exist.
+ $oldImagePath = $oldBasePath . '/' . $table->media_name;
+
+ if (!JFile::exists($oldImagePath)) {
+ continue;
+ }
+
+ // Generate new image using MD5
+ $newFileName = md5(basename($table->media_name)) . '.' . JFile::getExt($table->media_name);
+
+ if (!JFile::copy($oldImagePath, $path . '/' . $newFileName)) {
+ continue;
+ }
+
+ // Update media data with new file name.
+ $table->media_name = $newFileName;
+ $table->store();
+ }
+
+ // Remove old folders
+ JFolder::delete($oldBasePath);
+ }
}
diff --git a/component/admin/updates/2.0.14.php b/component/admin/updates/2.0.14.php
index cf8dffbcdc0..0b403eba708 100644
--- a/component/admin/updates/2.0.14.php
+++ b/component/admin/updates/2.0.14.php
@@ -18,125 +18,120 @@
*/
class RedshopUpdate2014 extends RedshopInstallUpdate
{
- /**
- * Method for migrate category images.
- *
- * @return void
- *
- * @since 2.0.14
- */
- public function migrateCategoryImages()
- {
- $db = JFactory::getDbo();
-
- $query = $db->getQuery(true)
- ->select($db->qn(array('id', 'name', 'category_full_image', 'category_back_full_image')))
- ->from($db->qn('#__redshop_category'))
- ->where(
- '('
- . $db->qn('category_full_image') . ' IS NOT NULL OR ' . $db->qn('category_full_image') . ' <> ' . $db->quote('')
- . ') OR ('
- . $db->qn('category_back_full_image') . ' IS NOT NULL OR ' . $db->qn('category_back_full_image') . ' <> ' . $db->quote('')
- . ')'
- )
- ->order($db->qn('lft'));
-
- $medias = $db->setQuery($query)->loadObjectList();
-
- if (empty($medias))
- {
- return;
- }
-
- $newBasePath = REDSHOP_MEDIA_IMAGE_RELPATH . 'category';
- $oldBasePath = REDSHOP_FRONT_IMAGES_RELPATH . 'category';
-
- foreach ($medias as $media)
- {
- // Prepare target folder.
- $path = $newBasePath . '/' . $media->id;
-
- if (!JFolder::exists($path))
- {
- JFolder::create($path);
- }
-
- // Copy index.html to this folder.
- if (!JFile::exists($path . '/index.html'))
- {
- JFile::copy(REDSHOP_MEDIA_IMAGE_RELPATH . 'index.html', $path . '/index.html');
- }
-
- if (!empty($media->category_full_image))
- {
- $this->storeMedia($media, $media->category_full_image, 'full', $oldBasePath, $newBasePath);
- }
-
- if (!empty($media->category_full_image))
- {
- $this->storeMedia($media, $media->category_back_full_image, 'back', $oldBasePath, $newBasePath);
- }
- }
-
- // Remove old folders
- JFolder::delete($oldBasePath);
- }
-
- /**
- * Method for store media
- *
- * @param object $category Category data
- * @param string $fileName File name
- * @param string $scope Scope of media.
- * @param string $oldBasePath Scope of media.
- * @param string $newBasePath Scope of media.
- *
- * @return void
- *
- * @since 2.0.14
- */
- private function storeMedia($category, $fileName, $scope, $oldBasePath, $newBasePath)
- {
- /** @var RedshopTableMedia $table */
- $table = RedshopTable::getAdminInstance('Media', array('ignore_request' => true), 'com_redshop');
-
- // Generate new image using MD5
- $newFileName = md5(basename($fileName)) . '.' . JFile::getExt($fileName);
-
- if (!$table->load(
- array(
- 'media_name' => $fileName,
- 'media_section' => 'category',
- 'section_id' => $category->id,
- 'media_type' => 'images'
- )
- ))
- {
- $table->section_id = $category->id;
- $table->media_section = 'category';
- $table->media_type = 'images';
- }
-
- $table->media_alternate_text = $category->name;
- $table->published = 1;
- $table->ordering = 0;
- $table->scope = $scope;
-
- // Check old image exist.
- $oldImagePath = $oldBasePath . '/' . $fileName;
-
- if (!JFile::exists($oldImagePath))
- {
- return;
- }
-
- if (!JFile::copy($oldImagePath, $newBasePath . '/' . $category->id . '/' . $newFileName))
- {
- return;
- }
-
- // Update media data with new file name.
- $table->media_name = $newFileName;
- $table->store();
- }
+ /**
+ * Method for migrate category images.
+ *
+ * @return void
+ *
+ * @since 2.0.14
+ */
+ public function migrateCategoryImages()
+ {
+ $db = JFactory::getDbo();
+
+ $query = $db->getQuery(true)
+ ->select($db->qn(array('id', 'name', 'category_full_image', 'category_back_full_image')))
+ ->from($db->qn('#__redshop_category'))
+ ->where(
+ '('
+ . $db->qn('category_full_image') . ' IS NOT NULL OR ' . $db->qn(
+ 'category_full_image'
+ ) . ' <> ' . $db->quote('')
+ . ') OR ('
+ . $db->qn('category_back_full_image') . ' IS NOT NULL OR ' . $db->qn(
+ 'category_back_full_image'
+ ) . ' <> ' . $db->quote('')
+ . ')'
+ )
+ ->order($db->qn('lft'));
+
+ $medias = $db->setQuery($query)->loadObjectList();
+
+ if (empty($medias)) {
+ return;
+ }
+
+ $newBasePath = REDSHOP_MEDIA_IMAGE_RELPATH . 'category';
+ $oldBasePath = REDSHOP_FRONT_IMAGES_RELPATH . 'category';
+
+ foreach ($medias as $media) {
+ // Prepare target folder.
+ $path = $newBasePath . '/' . $media->id;
+
+ if (!JFolder::exists($path)) {
+ JFolder::create($path);
+ }
+
+ // Copy index.html to this folder.
+ if (!JFile::exists($path . '/index.html')) {
+ JFile::copy(REDSHOP_MEDIA_IMAGE_RELPATH . 'index.html', $path . '/index.html');
+ }
+
+ if (!empty($media->category_full_image)) {
+ $this->storeMedia($media, $media->category_full_image, 'full', $oldBasePath, $newBasePath);
+ }
+
+ if (!empty($media->category_full_image)) {
+ $this->storeMedia($media, $media->category_back_full_image, 'back', $oldBasePath, $newBasePath);
+ }
+ }
+
+ // Remove old folders
+ JFolder::delete($oldBasePath);
+ }
+
+ /**
+ * Method for store media
+ *
+ * @param object $category Category data
+ * @param string $fileName File name
+ * @param string $scope Scope of media.
+ * @param string $oldBasePath Scope of media.
+ * @param string $newBasePath Scope of media.
+ *
+ * @return void
+ *
+ * @since 2.0.14
+ */
+ private function storeMedia($category, $fileName, $scope, $oldBasePath, $newBasePath)
+ {
+ /** @var RedshopTableMedia $table */
+ $table = RedshopTable::getAdminInstance('Media', array('ignore_request' => true), 'com_redshop');
+
+ // Generate new image using MD5
+ $newFileName = md5(basename($fileName)) . '.' . JFile::getExt($fileName);
+
+ if (!$table->load(
+ array(
+ 'media_name' => $fileName,
+ 'media_section' => 'category',
+ 'section_id' => $category->id,
+ 'media_type' => 'images'
+ )
+ )) {
+ $table->section_id = $category->id;
+ $table->media_section = 'category';
+ $table->media_type = 'images';
+ }
+
+ $table->media_alternate_text = $category->name;
+ $table->published = 1;
+ $table->ordering = 0;
+ $table->scope = $scope;
+
+ // Check old image exist.
+ $oldImagePath = $oldBasePath . '/' . $fileName;
+
+ if (!JFile::exists($oldImagePath)) {
+ return;
+ }
+
+ if (!JFile::copy($oldImagePath, $newBasePath . '/' . $category->id . '/' . $newFileName)) {
+ return;
+ }
+
+ // Update media data with new file name.
+ $table->media_name = $newFileName;
+ $table->store();
+ }
}
diff --git a/component/admin/updates/2.0.15.php b/component/admin/updates/2.0.15.php
index 754c4c3f6fa..3f34d1c9074 100644
--- a/component/admin/updates/2.0.15.php
+++ b/component/admin/updates/2.0.15.php
@@ -18,34 +18,34 @@
*/
class RedshopUpdate2015 extends RedshopInstallUpdate
{
- /**
- * Return list of old files for clean
- *
- * @return array
- *
- * @since 2.0.15
- */
- protected function getOldFiles()
- {
- return array(
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/manufacturer_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/manufacturer_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/manufacturer_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/manufacturer/tmpl/default.php'
- );
- }
+ /**
+ * Return list of old files for clean
+ *
+ * @return array
+ *
+ * @since 2.0.15
+ */
+ protected function getOldFiles()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/manufacturer_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/manufacturer_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/manufacturer_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/manufacturer/tmpl/default.php'
+ );
+ }
- /**
- * Return list of old folders for clean
- *
- * @return array
- *
- * @since 2.0.15
- */
- protected function getOldFolders()
- {
- return array(
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/manufacturer_detail'
- );
- }
+ /**
+ * Return list of old folders for clean
+ *
+ * @return array
+ *
+ * @since 2.0.15
+ */
+ protected function getOldFolders()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/manufacturer_detail'
+ );
+ }
}
diff --git a/component/admin/updates/2.0.3.php b/component/admin/updates/2.0.3.php
index e0f4cc1492c..27d38a15531 100644
--- a/component/admin/updates/2.0.3.php
+++ b/component/admin/updates/2.0.3.php
@@ -20,494 +20,455 @@
*/
class RedshopUpdate203 extends RedshopInstallUpdate
{
- /**
- * Return list of old files for clean
- *
- * @return array
- *
- * @since 2.0.3
- */
- protected function getOldFiles()
- {
- return array(
- JPATH_ADMINISTRATOR . '/component/admin/controllers/supplier_detail.php',
- JPATH_ADMINISTRATOR . '/component/admin/controllers/tax.php',
- JPATH_ADMINISTRATOR . '/component/admin/controllers/tax_detail.php',
- JPATH_ADMINISTRATOR . '/component/admin/controllers/mass_discount_detail.php',
- JPATH_ADMINISTRATOR . '/component/admin/models/supplier_detail.php',
- JPATH_ADMINISTRATOR . '/component/admin/models/mass_discount_detail.php',
- JPATH_ADMINISTRATOR . '/component/admin/models/tax.php',
- JPATH_ADMINISTRATOR . '/component/admin/models/tax_detail.php',
- JPATH_ADMINISTRATOR . '/component/admin/tables/supplier_detail.php',
- JPATH_ADMINISTRATOR . '/component/admin/tables/mass_discount_detail.php',
- JPATH_ADMINISTRATOR . '/component/admin/tables/tax_detail.php',
- JPATH_ADMINISTRATOR . '/component/admin/views/supplier/tmpl/default.php',
- JPATH_ADMINISTRATOR . '/component/admin/views/mass_discount/tmpl/default.php',
- JPATH_SITE . '/media/com_redshop/css/media.css',
- JPATH_SITE . '/media/com_redshop/css/media-uncompressed.css',
- JPATH_SITE . '/media/com_redshop/js/media.js',
- JPATH_SITE . '/media/com_redshop/js/media-uncompressed.js',
- JPATH_ADMINISTRATOR . '/component/admin/views/order_detail/view.tcpdf.php',
- JPATH_LIBRARIES . '/redshop/helper/tcpdf.php'
- );
- }
-
- /**
- * Return list of old folders for clean
- *
- * @return array
- *
- * @since 2.0.3
- */
- protected function getOldFolders()
- {
- return array(
- JPATH_ADMINISTRATOR . '/component/admin/views/supplier_detail',
- JPATH_ADMINISTRATOR . '/component/admin/views/tax',
- JPATH_ADMINISTRATOR . '/component/admin/views/mass_discount_detail',
- JPATH_ADMINISTRATOR . '/component/admin/views/tax_detail'
- );
- }
-
- /**
- * Method for update override template when update.
- *
- * @return void
- *
- * @since 2.0.4
- */
- public static function updateOverrideTemplate()
- {
- $dir = JPATH_SITE . '/templates/';
- $codeDir = JPATH_SITE . '/code/';
- $files = JFolder::folders($dir);
- $templates = array();
- $adminHelpers = array();
- $adminTemplateHelpers = array();
-
- if (JFolder::exists($codeDir))
- {
- $codeFiles = JFolder::folders($codeDir);
-
- foreach ($codeFiles as $key => $value)
- {
- if (JFolder::exists($codeDir . 'administrator/components'))
- {
- $templates[$codeDir . 'administrator/components'] = JFolder::folders($codeDir . 'administrator/components');
- }
-
- if (JFolder::exists($codeDir . 'administrator'))
- {
- $templates[$codeDir . 'administrator'] = JFolder::folders($codeDir . 'administrator');
- }
-
- if (JFolder::exists($codeDir . 'components'))
- {
- $templates[$codeDir . 'components'] = JFolder::folders($codeDir . 'components');
- }
-
- if (JFolder::exists($codeDir))
- {
- $templates[$codeDir] = JFolder::folders($codeDir);
- }
-
- if (JFolder::exists($codeDir . 'com_redshop/helpers'))
- {
- $adminHelpers[$codeDir . 'com_redshop/helpers'] = JFolder::files($codeDir . 'com_redshop/helpers');
- }
- }
- }
-
- foreach ($files as $key => $value)
- {
- if (!JFile::exists($dir . $value))
- {
- $templates[$dir . $value] = JFolder::folders($dir . $value);
- }
- }
-
- $override = array();
- $jsOverride = array();
-
- self::getOverrideFromTemplates($templates, $override, $jsOverride, $adminTemplateHelpers);
-
- $overrideFiles = self::getOverrideFiles($override);
-
- $app = JFactory::getApplication();
- $data = Redshop::getConfig()->toArray();
- $temp = $app->getUserState('com_redshop.config.global.data');
-
- if (!empty($temp))
- {
- $data = array_merge($data, $temp);
- }
-
- $data['BACKWARD_COMPATIBLE_PHP'] = 0;
- $data['BACKWARD_COMPATIBLE_JS'] = 0;
- $config = Redshop::getConfig();
-
- if (!empty($overrideFiles))
- {
- self::replaceCode($overrideFiles);
-
- // Check site used MVC && Templates Override
- $data['BACKWARD_COMPATIBLE_PHP'] = 1;
- }
-
- if (!empty($jsOverride))
- {
- // Check site used JS Override
- $data['BACKWARD_COMPATIBLE_JS'] = 1;
- }
-
- $app->setUserState('com_redshop.config.global.data', $data);
- $data = new Registry($data);
- $config->save($data);
-
- self::moveAdminHelper($adminHelpers, $codeDir);
- self::moveAdminTemplateHelper($adminTemplateHelpers);
- }
-
- /**
- * Method for get override files
- *
- * @param array $override Override
- *
- * @return array
- *
- * @since 2.0.3
- */
- private static function getOverrideFiles($override)
- {
- if (empty($override))
- {
- return array();
- }
-
- $overrideFolders = array();
- $overrideLayoutFolders = array();
- $overrideLayoutFiles = array();
- $overrideFiles = array();
-
- foreach ($override as $key => $value)
- {
- foreach ($value as $name)
- {
- if ($name === 'layouts')
- {
- $overrideLayoutFolders[$key . '/' . $name] = JFolder::folders($key . '/' . $name);
- }
- elseif (!JFile::exists($key . '/' . $name) && ($name === 'com_redshop' || strpos($name, 'mod_redshop') !== false))
- {
- // Read all files and folders in parent folder
- $overrideFolders[$key . '/' . $name] = array_diff(scandir($key . '/' . $name), array('.', '..'));
- }
- }
- }
-
- foreach ($overrideFolders as $key => $value)
- {
- foreach ($value as $name)
- {
- $target = !JFile::exists($key . '/' . $name) ? $key . '/' . $name : $key;
- $overrideFiles[$target] = JFolder::files($target);
- }
- }
-
- foreach ($overrideLayoutFolders as $key => $value)
- {
- foreach ($value as $name)
- {
- if ($name !== 'com_redshop' || JFile::exists($key . '/' . $name))
- {
- continue;
- }
-
- $overrideLayoutFiles[$key . '/' . $name] = JFolder::files($key . '/' . $name);
- }
- }
-
- if (!empty($overrideLayoutFiles))
- {
- foreach ($overrideLayoutFiles as $key => $value)
- {
- foreach ($value as $name)
- {
- if (JFile::exists($key . '/' . $name))
- {
- continue;
- }
-
- $overrideFiles[$key . '/' . $name] = JFolder::files($key . '/' . $name);
- }
- }
- }
-
- return $overrideFiles;
- }
-
- /**
- * Method for replace helper override.
- *
- * @param array $overrideFiles Override Files
- *
- * @return void
- * @since 2.0.3
- */
- private static function replaceCode($overrideFiles)
- {
- if (empty($overrideFiles))
- {
- return;
- }
-
- $replaceString = array(
- 'new quotationHelper()' => 'quotationHelper::getInstance()',
- 'new order_functions()' => 'order_functions::getInstance()',
- 'new Redconfiguration()' => 'Redconfiguration::getInstance()',
- 'new Redconfiguration' => 'Redconfiguration::getInstance()',
- 'new Redtemplate()' => 'Redtemplate::getInstance()',
- 'new Redtemplate' => 'Redtemplate::getInstance()',
- 'new extra_field()' => 'extra_field::getInstance()',
- 'new rsstockroomhelper()' => 'rsstockroomhelper::getInstance()',
- 'new rsstockroomhelper' => 'rsstockroomhelper::getInstance()',
- 'new shipping()' => 'shipping::getInstance()',
- 'new CurrencyHelper()' => 'CurrencyHelper::getInstance()',
- 'new economic()' => 'economic::getInstance()',
- 'new rsUserhelper()' => 'rsUserHelper::getInstance()',
- 'new rsUserhelper' => 'rsUserHelper::getInstance()',
- 'GoogleAnalytics' => 'RedshopHelperGoogleanalytics',
- 'new quotationHelper' => 'quotationHelper::getInstance()',
- 'new order_functions' => 'order_functions::getInstance()',
- 'new extra_field' => 'extra_field::getInstance()',
- 'new shipping' => 'shipping::getInstance()',
- 'new CurrencyHelper' => 'CurrencyHelper::getInstance()',
- 'new economic' => 'economic::getInstance()',
- 'RedshopConfig::scriptDeclaration();' => '',
- '$redConfiguration' => '$Redconfiguration',
- 'require_once JPATH_SITE . \'/components/com_redshop/helpers/redshop.js.php\'' => '',
- );
-
- foreach ($overrideFiles as $path => $files)
- {
- foreach ($files as $file)
- {
- $content = file_get_contents($path . '/' . $file);
-
- foreach ($replaceString as $old => $new)
- {
- if (strpos($content, $old) === false)
- {
- continue;
- }
-
- $content = str_replace($old, $new, $content);
- JFile::write($path . '/' . $file, $content);
- }
- }
- }
- }
-
- /**
- * Method for replace helper override.
- *
- * @param array $adminHelpers Admin helpers
- * @param string $codeDir Code directory
- *
- * @return void
- * @since 2.0.3
- */
- private static function moveAdminHelper($adminHelpers, $codeDir)
- {
- if (empty($adminHelpers))
- {
- return;
- }
-
- $replaceAdminHelper = array(
- 'adminorder.php' => 'order_functions.php',
- 'admincategory.php' => 'product_category.php',
- 'adminquotation.php' => 'quotationhelper.php',
- 'adminaccess_level.php' => 'redaccesslevel.php',
- 'adminconfiguration.php' => 'redconfiguration.php',
- 'adminmedia.php' => 'redmediahelper.php',
- 'adminimages.php' => 'redshophelperimages.php',
- 'adminmail.php' => 'redshopmail.php',
- 'adminupdate.php' => 'redshopupdate.php',
- 'admintemplate.php' => 'redtemplate.php',
- 'adminstockroom.php' => 'rsstockroom.php',
- 'adminshopper.php' => 'shoppergroup.php'
- );
-
- $replaceSiteHelper = array(
- 'currency.php' => 'currencyhelper.php',
- 'extra_field.php' => 'extrafield.php',
- 'google_analytics.php' => 'googleanalytics.php',
- );
-
- foreach ($adminHelpers as $path => $files)
- {
- foreach ($replaceAdminHelper as $old => $new)
- {
- if (!JFile::exists($path . '/' . $old))
- {
- continue;
- }
-
- if (!JFolder::exists($codeDir . 'administrator/components/com_redshop/helpers'))
- {
- JFolder::create($codeDir . 'administrator/components/com_redshop/helpers');
- }
-
- JFile::move($codeDir . 'com_redshop/helpers/' . $old, $codeDir . 'administrator/components/com_redshop/helpers/' . $new);
- }
-
- foreach ($replaceSiteHelper as $old => $new)
- {
- if (!JFile::exists($path . '/' . $old))
- {
- continue;
- }
-
- if (!JFolder::exists($codeDir . 'components/com_redshop/helpers'))
- {
- JFolder::create($codeDir . 'components/com_redshop/helpers');
- }
-
- JFile::move($codeDir . 'com_redshop/helpers/' . $old, $codeDir . 'components/com_redshop/helpers/' . $new);
- }
- }
- }
-
- /**
- * Method for replace helper override.
- *
- * @param array $adminTemplateHelpers Admin template helpers
- *
- * @return void
- * @since 2.0.3
- */
- private static function moveAdminTemplateHelper($adminTemplateHelpers)
- {
- if (empty($adminTemplateHelpers))
- {
- return;
- }
-
- $replaceAdminHelper = array(
- 'adminorder.php' => 'order_functions.php',
- 'admincategory.php' => 'product_category.php',
- 'adminquotation.php' => 'quotationhelper.php',
- 'adminaccess_level.php' => 'redaccesslevel.php',
- 'adminconfiguration.php' => 'redconfiguration.php',
- 'adminmedia.php' => 'redmediahelper.php',
- 'adminimages.php' => 'redshophelperimages.php',
- 'adminmail.php' => 'redshopmail.php',
- 'adminupdate.php' => 'redshopupdate.php',
- 'admintemplate.php' => 'redtemplate.php',
- 'adminstockroom.php' => 'rsstockroom.php',
- 'adminshopper.php' => 'shoppergroup.php'
- );
-
- $replaceSiteHelper = array(
- 'currency.php' => 'currencyhelper.php',
- 'extra_field.php' => 'extrafield.php',
- 'google_analytics.php' => 'googleanalytics.php',
- 'product.php' => 'producthelper.php',
- );
-
- foreach ($adminTemplateHelpers as $path => $files)
- {
- foreach ($replaceAdminHelper as $old => $new)
- {
- if (!JFile::exists($path . '/code/com_redshop/helpers/' . $old))
- {
- continue;
- }
-
- if (!JFolder::exists($path . '/code/administrator/components/com_redshop/helpers'))
- {
- JFolder::create($path . '/code/administrator/components/com_redshop/helpers');
- }
-
- JFile::move($path . '/code/com_redshop/helpers/' . $old, $path . '/code/administrator/components/com_redshop/helpers/' . $new);
- }
-
- foreach ($replaceSiteHelper as $old => $new)
- {
- if (!JFile::exists($path . '/code/com_redshop/helpers/' . $old))
- {
- continue;
- }
-
- if (!JFolder::exists($path . '/code/components/com_redshop/helpers'))
- {
- JFolder::create($path . '/code/components/com_redshop/helpers');
- }
-
- JFile::move($path . '/code/com_redshop/helpers/' . $old, $path . '/code/components/com_redshop/helpers/' . $new);
- }
- }
- }
-
- /**
- * Get override template from templates.
- *
- * @param array $templates Templates
- * @param array $override Overrides
- * @param array $jsOverride Javascript overrides
- * @param array $adminTemplateHelpers Admin template overrides.
- *
- *
- * @return void
- * @since 2.0.3
- */
- private static function getOverrideFromTemplates($templates, &$override, &$jsOverride, &$adminTemplateHelpers)
- {
- if (empty($templates))
- {
- return;
- }
-
- foreach ($templates as $key => $value)
- {
- foreach ($value as $name)
- {
- if (JFile::exists($key . '/' . $name))
- {
- continue;
- }
-
- if (JFolder::exists($key . '/com_redshop'))
- {
- $override[$key . '/com_redshop'] = JFolder::folders($key . '/com_redshop');
- }
-
- if (JFolder::exists($key . '/html'))
- {
- $override[$key . '/html'] = JFolder::folders($key . '/html');
- }
-
- if (JFolder::exists($key . '/js/com_redshop'))
- {
- $jsOverride[$key . '/js/com_redshop'] = JFolder::files($key . '/js/com_redshop');
- }
-
- if (JFolder::exists($key . '/code/com_redshop'))
- {
- $override[$key . '/code/com_redshop'] = JFolder::folders($key . '/code/com_redshop');
- }
-
- if (JFolder::exists($key . '/code/components/com_redshop'))
- {
- $override[$key . '/code/components/com_redshop'] = JFolder::folders($key . '/code/components/com_redshop');
- }
-
- if (JFolder::exists($key . '/code/com_redshop/helpers'))
- {
- $adminTemplateHelpers[$key] = JFolder::files($key . '/code/com_redshop/helpers');
- }
- }
- }
- }
+ /**
+ * Method for update override template when update.
+ *
+ * @return void
+ *
+ * @since 2.0.4
+ */
+ public static function updateOverrideTemplate()
+ {
+ $dir = JPATH_SITE . '/templates/';
+ $codeDir = JPATH_SITE . '/code/';
+ $files = JFolder::folders($dir);
+ $templates = array();
+ $adminHelpers = array();
+ $adminTemplateHelpers = array();
+
+ if (JFolder::exists($codeDir)) {
+ $codeFiles = JFolder::folders($codeDir);
+
+ foreach ($codeFiles as $key => $value) {
+ if (JFolder::exists($codeDir . 'administrator/components')) {
+ $templates[$codeDir . 'administrator/components'] = JFolder::folders(
+ $codeDir . 'administrator/components'
+ );
+ }
+
+ if (JFolder::exists($codeDir . 'administrator')) {
+ $templates[$codeDir . 'administrator'] = JFolder::folders($codeDir . 'administrator');
+ }
+
+ if (JFolder::exists($codeDir . 'components')) {
+ $templates[$codeDir . 'components'] = JFolder::folders($codeDir . 'components');
+ }
+
+ if (JFolder::exists($codeDir)) {
+ $templates[$codeDir] = JFolder::folders($codeDir);
+ }
+
+ if (JFolder::exists($codeDir . 'com_redshop/helpers')) {
+ $adminHelpers[$codeDir . 'com_redshop/helpers'] = JFolder::files($codeDir . 'com_redshop/helpers');
+ }
+ }
+ }
+
+ foreach ($files as $key => $value) {
+ if (!JFile::exists($dir . $value)) {
+ $templates[$dir . $value] = JFolder::folders($dir . $value);
+ }
+ }
+
+ $override = array();
+ $jsOverride = array();
+
+ self::getOverrideFromTemplates($templates, $override, $jsOverride, $adminTemplateHelpers);
+
+ $overrideFiles = self::getOverrideFiles($override);
+
+ $app = JFactory::getApplication();
+ $data = Redshop::getConfig()->toArray();
+ $temp = $app->getUserState('com_redshop.config.global.data');
+
+ if (!empty($temp)) {
+ $data = array_merge($data, $temp);
+ }
+
+ $data['BACKWARD_COMPATIBLE_PHP'] = 0;
+ $data['BACKWARD_COMPATIBLE_JS'] = 0;
+ $config = Redshop::getConfig();
+
+ if (!empty($overrideFiles)) {
+ self::replaceCode($overrideFiles);
+
+ // Check site used MVC && Templates Override
+ $data['BACKWARD_COMPATIBLE_PHP'] = 1;
+ }
+
+ if (!empty($jsOverride)) {
+ // Check site used JS Override
+ $data['BACKWARD_COMPATIBLE_JS'] = 1;
+ }
+
+ $app->setUserState('com_redshop.config.global.data', $data);
+ $data = new Registry($data);
+ $config->save($data);
+
+ self::moveAdminHelper($adminHelpers, $codeDir);
+ self::moveAdminTemplateHelper($adminTemplateHelpers);
+ }
+
+ /**
+ * Get override template from templates.
+ *
+ * @param array $templates Templates
+ * @param array $override Overrides
+ * @param array $jsOverride Javascript overrides
+ * @param array $adminTemplateHelpers Admin template overrides.
+ *
+ *
+ * @return void
+ * @since 2.0.3
+ */
+ private static function getOverrideFromTemplates($templates, &$override, &$jsOverride, &$adminTemplateHelpers)
+ {
+ if (empty($templates)) {
+ return;
+ }
+
+ foreach ($templates as $key => $value) {
+ foreach ($value as $name) {
+ if (JFile::exists($key . '/' . $name)) {
+ continue;
+ }
+
+ if (JFolder::exists($key . '/com_redshop')) {
+ $override[$key . '/com_redshop'] = JFolder::folders($key . '/com_redshop');
+ }
+
+ if (JFolder::exists($key . '/html')) {
+ $override[$key . '/html'] = JFolder::folders($key . '/html');
+ }
+
+ if (JFolder::exists($key . '/js/com_redshop')) {
+ $jsOverride[$key . '/js/com_redshop'] = JFolder::files($key . '/js/com_redshop');
+ }
+
+ if (JFolder::exists($key . '/code/com_redshop')) {
+ $override[$key . '/code/com_redshop'] = JFolder::folders($key . '/code/com_redshop');
+ }
+
+ if (JFolder::exists($key . '/code/components/com_redshop')) {
+ $override[$key . '/code/components/com_redshop'] = JFolder::folders(
+ $key . '/code/components/com_redshop'
+ );
+ }
+
+ if (JFolder::exists($key . '/code/com_redshop/helpers')) {
+ $adminTemplateHelpers[$key] = JFolder::files($key . '/code/com_redshop/helpers');
+ }
+ }
+ }
+ }
+
+ /**
+ * Method for get override files
+ *
+ * @param array $override Override
+ *
+ * @return array
+ *
+ * @since 2.0.3
+ */
+ private static function getOverrideFiles($override)
+ {
+ if (empty($override)) {
+ return array();
+ }
+
+ $overrideFolders = array();
+ $overrideLayoutFolders = array();
+ $overrideLayoutFiles = array();
+ $overrideFiles = array();
+
+ foreach ($override as $key => $value) {
+ foreach ($value as $name) {
+ if ($name === 'layouts') {
+ $overrideLayoutFolders[$key . '/' . $name] = JFolder::folders($key . '/' . $name);
+ } elseif (!JFile::exists($key . '/' . $name) && ($name === 'com_redshop' || strpos(
+ $name,
+ 'mod_redshop'
+ ) !== false)) {
+ // Read all files and folders in parent folder
+ $overrideFolders[$key . '/' . $name] = array_diff(scandir($key . '/' . $name), array('.', '..'));
+ }
+ }
+ }
+
+ foreach ($overrideFolders as $key => $value) {
+ foreach ($value as $name) {
+ $target = !JFile::exists($key . '/' . $name) ? $key . '/' . $name : $key;
+ $overrideFiles[$target] = JFolder::files($target);
+ }
+ }
+
+ foreach ($overrideLayoutFolders as $key => $value) {
+ foreach ($value as $name) {
+ if ($name !== 'com_redshop' || JFile::exists($key . '/' . $name)) {
+ continue;
+ }
+
+ $overrideLayoutFiles[$key . '/' . $name] = JFolder::files($key . '/' . $name);
+ }
+ }
+
+ if (!empty($overrideLayoutFiles)) {
+ foreach ($overrideLayoutFiles as $key => $value) {
+ foreach ($value as $name) {
+ if (JFile::exists($key . '/' . $name)) {
+ continue;
+ }
+
+ $overrideFiles[$key . '/' . $name] = JFolder::files($key . '/' . $name);
+ }
+ }
+ }
+
+ return $overrideFiles;
+ }
+
+ /**
+ * Method for replace helper override.
+ *
+ * @param array $overrideFiles Override Files
+ *
+ * @return void
+ * @since 2.0.3
+ */
+ private static function replaceCode($overrideFiles)
+ {
+ if (empty($overrideFiles)) {
+ return;
+ }
+
+ $replaceString = array(
+ 'new quotationHelper()' => 'quotationHelper::getInstance()',
+ 'new order_functions()' => 'order_functions::getInstance()',
+ 'new Redconfiguration()' => 'Redconfiguration::getInstance()',
+ 'new Redconfiguration' => 'Redconfiguration::getInstance()',
+ 'new Redtemplate()' => 'Redtemplate::getInstance()',
+ 'new Redtemplate' => 'Redtemplate::getInstance()',
+ 'new extra_field()' => 'extra_field::getInstance()',
+ 'new rsstockroomhelper()' => 'rsstockroomhelper::getInstance()',
+ 'new rsstockroomhelper' => 'rsstockroomhelper::getInstance()',
+ 'new shipping()' => 'shipping::getInstance()',
+ 'new CurrencyHelper()' => 'CurrencyHelper::getInstance()',
+ 'new economic()' => 'economic::getInstance()',
+ 'new rsUserhelper()' => 'rsUserHelper::getInstance()',
+ 'new rsUserhelper' => 'rsUserHelper::getInstance()',
+ 'GoogleAnalytics' => 'RedshopHelperGoogleanalytics',
+ 'new quotationHelper' => 'quotationHelper::getInstance()',
+ 'new order_functions' => 'order_functions::getInstance()',
+ 'new extra_field' => 'extra_field::getInstance()',
+ 'new shipping' => 'shipping::getInstance()',
+ 'new CurrencyHelper' => 'CurrencyHelper::getInstance()',
+ 'new economic' => 'economic::getInstance()',
+ 'RedshopConfig::scriptDeclaration();' => '',
+ '$redConfiguration' => '$Redconfiguration',
+ 'require_once JPATH_SITE . \'/components/com_redshop/helpers/redshop.js.php\'' => '',
+ );
+
+ foreach ($overrideFiles as $path => $files) {
+ foreach ($files as $file) {
+ $content = file_get_contents($path . '/' . $file);
+
+ foreach ($replaceString as $old => $new) {
+ if (strpos($content, $old) === false) {
+ continue;
+ }
+
+ $content = str_replace($old, $new, $content);
+ JFile::write($path . '/' . $file, $content);
+ }
+ }
+ }
+ }
+
+ /**
+ * Method for replace helper override.
+ *
+ * @param array $adminHelpers Admin helpers
+ * @param string $codeDir Code directory
+ *
+ * @return void
+ * @since 2.0.3
+ */
+ private static function moveAdminHelper($adminHelpers, $codeDir)
+ {
+ if (empty($adminHelpers)) {
+ return;
+ }
+
+ $replaceAdminHelper = array(
+ 'adminorder.php' => 'order_functions.php',
+ 'admincategory.php' => 'product_category.php',
+ 'adminquotation.php' => 'quotationhelper.php',
+ 'adminaccess_level.php' => 'redaccesslevel.php',
+ 'adminconfiguration.php' => 'redconfiguration.php',
+ 'adminmedia.php' => 'redmediahelper.php',
+ 'adminimages.php' => 'redshophelperimages.php',
+ 'adminmail.php' => 'redshopmail.php',
+ 'adminupdate.php' => 'redshopupdate.php',
+ 'admintemplate.php' => 'redtemplate.php',
+ 'adminstockroom.php' => 'rsstockroom.php',
+ 'adminshopper.php' => 'shoppergroup.php'
+ );
+
+ $replaceSiteHelper = array(
+ 'currency.php' => 'currencyhelper.php',
+ 'extra_field.php' => 'extrafield.php',
+ 'google_analytics.php' => 'googleanalytics.php',
+ );
+
+ foreach ($adminHelpers as $path => $files) {
+ foreach ($replaceAdminHelper as $old => $new) {
+ if (!JFile::exists($path . '/' . $old)) {
+ continue;
+ }
+
+ if (!JFolder::exists($codeDir . 'administrator/components/com_redshop/helpers')) {
+ JFolder::create($codeDir . 'administrator/components/com_redshop/helpers');
+ }
+
+ JFile::move(
+ $codeDir . 'com_redshop/helpers/' . $old,
+ $codeDir . 'administrator/components/com_redshop/helpers/' . $new
+ );
+ }
+
+ foreach ($replaceSiteHelper as $old => $new) {
+ if (!JFile::exists($path . '/' . $old)) {
+ continue;
+ }
+
+ if (!JFolder::exists($codeDir . 'components/com_redshop/helpers')) {
+ JFolder::create($codeDir . 'components/com_redshop/helpers');
+ }
+
+ JFile::move(
+ $codeDir . 'com_redshop/helpers/' . $old,
+ $codeDir . 'components/com_redshop/helpers/' . $new
+ );
+ }
+ }
+ }
+
+ /**
+ * Method for replace helper override.
+ *
+ * @param array $adminTemplateHelpers Admin template helpers
+ *
+ * @return void
+ * @since 2.0.3
+ */
+ private static function moveAdminTemplateHelper($adminTemplateHelpers)
+ {
+ if (empty($adminTemplateHelpers)) {
+ return;
+ }
+
+ $replaceAdminHelper = array(
+ 'adminorder.php' => 'order_functions.php',
+ 'admincategory.php' => 'product_category.php',
+ 'adminquotation.php' => 'quotationhelper.php',
+ 'adminaccess_level.php' => 'redaccesslevel.php',
+ 'adminconfiguration.php' => 'redconfiguration.php',
+ 'adminmedia.php' => 'redmediahelper.php',
+ 'adminimages.php' => 'redshophelperimages.php',
+ 'adminmail.php' => 'redshopmail.php',
+ 'adminupdate.php' => 'redshopupdate.php',
+ 'admintemplate.php' => 'redtemplate.php',
+ 'adminstockroom.php' => 'rsstockroom.php',
+ 'adminshopper.php' => 'shoppergroup.php'
+ );
+
+ $replaceSiteHelper = array(
+ 'currency.php' => 'currencyhelper.php',
+ 'extra_field.php' => 'extrafield.php',
+ 'google_analytics.php' => 'googleanalytics.php',
+ 'product.php' => 'producthelper.php',
+ );
+
+ foreach ($adminTemplateHelpers as $path => $files) {
+ foreach ($replaceAdminHelper as $old => $new) {
+ if (!JFile::exists($path . '/code/com_redshop/helpers/' . $old)) {
+ continue;
+ }
+
+ if (!JFolder::exists($path . '/code/administrator/components/com_redshop/helpers')) {
+ JFolder::create($path . '/code/administrator/components/com_redshop/helpers');
+ }
+
+ JFile::move(
+ $path . '/code/com_redshop/helpers/' . $old,
+ $path . '/code/administrator/components/com_redshop/helpers/' . $new
+ );
+ }
+
+ foreach ($replaceSiteHelper as $old => $new) {
+ if (!JFile::exists($path . '/code/com_redshop/helpers/' . $old)) {
+ continue;
+ }
+
+ if (!JFolder::exists($path . '/code/components/com_redshop/helpers')) {
+ JFolder::create($path . '/code/components/com_redshop/helpers');
+ }
+
+ JFile::move(
+ $path . '/code/com_redshop/helpers/' . $old,
+ $path . '/code/components/com_redshop/helpers/' . $new
+ );
+ }
+ }
+ }
+
+ /**
+ * Return list of old files for clean
+ *
+ * @return array
+ *
+ * @since 2.0.3
+ */
+ protected function getOldFiles()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/component/admin/controllers/supplier_detail.php',
+ JPATH_ADMINISTRATOR . '/component/admin/controllers/tax.php',
+ JPATH_ADMINISTRATOR . '/component/admin/controllers/tax_detail.php',
+ JPATH_ADMINISTRATOR . '/component/admin/controllers/mass_discount_detail.php',
+ JPATH_ADMINISTRATOR . '/component/admin/models/supplier_detail.php',
+ JPATH_ADMINISTRATOR . '/component/admin/models/mass_discount_detail.php',
+ JPATH_ADMINISTRATOR . '/component/admin/models/tax.php',
+ JPATH_ADMINISTRATOR . '/component/admin/models/tax_detail.php',
+ JPATH_ADMINISTRATOR . '/component/admin/tables/supplier_detail.php',
+ JPATH_ADMINISTRATOR . '/component/admin/tables/mass_discount_detail.php',
+ JPATH_ADMINISTRATOR . '/component/admin/tables/tax_detail.php',
+ JPATH_ADMINISTRATOR . '/component/admin/views/supplier/tmpl/default.php',
+ JPATH_ADMINISTRATOR . '/component/admin/views/mass_discount/tmpl/default.php',
+ JPATH_SITE . '/media/com_redshop/css/media.css',
+ JPATH_SITE . '/media/com_redshop/css/media-uncompressed.css',
+ JPATH_SITE . '/media/com_redshop/js/media.js',
+ JPATH_SITE . '/media/com_redshop/js/media-uncompressed.js',
+ JPATH_ADMINISTRATOR . '/component/admin/views/order_detail/view.tcpdf.php',
+ JPATH_LIBRARIES . '/redshop/helper/tcpdf.php'
+ );
+ }
+
+ /**
+ * Return list of old folders for clean
+ *
+ * @return array
+ *
+ * @since 2.0.3
+ */
+ protected function getOldFolders()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/component/admin/views/supplier_detail',
+ JPATH_ADMINISTRATOR . '/component/admin/views/tax',
+ JPATH_ADMINISTRATOR . '/component/admin/views/mass_discount_detail',
+ JPATH_ADMINISTRATOR . '/component/admin/views/tax_detail'
+ );
+ }
}
diff --git a/component/admin/updates/2.0.4.php b/component/admin/updates/2.0.4.php
index 71366377a1f..212c1d7e323 100644
--- a/component/admin/updates/2.0.4.php
+++ b/component/admin/updates/2.0.4.php
@@ -18,147 +18,144 @@
*/
class RedshopUpdate204 extends RedshopInstallUpdate
{
- /**
- * Return list of old files for clean
- *
- * @return array
- *
- * @since 2.0.4
- */
- protected function getOldFiles()
- {
- return array(
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/update.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redshopupdate.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/update.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/tax_group_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/tax_group_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/tax_group_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/tax_group/tmpl/default.php',
- JPATH_SITE . '/libraries/redshop/install/database.php'
- );
- }
-
- /**
- * Return list of old folders for clean
- *
- * @return array
- *
- * @since 2.0.4
- */
- protected function getOldFolders()
- {
- return array(
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/update',
- JPATH_ADMINISTRATOR . '/components/com_redshop/extras/sh404sef/sef_ext',
- JPATH_ADMINISTRATOR . '/components/com_redshop/extras/sh404sef/meta_ext',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/barcode',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/tax_group_detail'
- );
- }
-
- /**
- * Change images file name
- *
- * @param array $files List files in image folder
- * @param string $path Path to folder
- *
- * @return void
- */
- protected function changeImageFileName(&$files, &$path)
- {
- if (empty($files))
- {
- return;
- }
-
- foreach ($files as $file)
- {
- $fileName = str_replace(array('%20', ' '), '-', $file);
-
- JFile::move($path . $file, $path . $fileName);
- }
- }
-
- /**
- * Method for rename image files name to correct format.
- *
- * @return void
- *
- * @since 2.0.4
- */
- public function updateImageFileNames()
- {
- $db = JFactory::getDbo();
-
- /** Update DB */
- $fields = array(
- $db->qn('product_full_image') . ' = REPLACE(' . $db->qn('product_full_image') . ", '%20', '-')",
- $db->qn('product_full_image') . ' = REPLACE(' . $db->qn('product_full_image') . ", ' ', '-')",
- $db->qn('product_thumb_image') . ' = REPLACE(' . $db->qn('product_thumb_image') . ", '%20', '-')",
- $db->qn('product_thumb_image') . ' = REPLACE(' . $db->qn('product_thumb_image') . ", ' ', '-')"
- );
-
- $query = $db->getQuery(true)
- ->update($db->qn('#__redshop_product'))
- ->set($fields);
- $db->setQuery($query)->execute();
-
- /** Update Image Name */
- $files = JFolder::files(JPATH_SITE . '/components/com_redshop/assets/images/product/');
- $this->changeImageFileName($files, $path);
-
- $files = JFolder::files(JPATH_SITE . '/components/com_redshop/assets/images/product/thumb/');
- $this->changeImageFileName($files, $path);
- }
-
- /**
- * Method for update menu item id if necessary.
- *
- * @return void
- *
- * @since 2.0.4
- */
- public function updateMenuItem()
- {
- $db = JFactory::getDbo();
-
- // For Blank component id in menu table-admin menu error solution - Get redSHOP extension id from the table
- $query = $db->getQuery(true)
- ->select('extension_id')
- ->from($db->qn('#__extensions'))
- ->where($db->qn('name') . ' LIKE ' . $db->quote('%redshop'))
- ->where($db->qn('element') . ' = ' . $db->quote('com_redshop'))
- ->where($db->qn('type') . ' = ' . $db->quote('component'));
-
- $extensionId = $db->setQuery($query)->loadResult();
-
- // Check for component menu item entry
- $query->clear()
- ->select('id,component_id')
- ->from($db->qn('#__menu'))
- ->where($db->qn('menutype') . ' = ' . $db->quote('main'))
- ->where($db->qn('path') . ' LIKE ' . $db->quote('%redshop'))
- ->where($db->qn('type') . ' = ' . $db->quote('component'));
-
- $menuItem = $db->setQuery($query)->loadObject();
-
- // If component Entry found and component_id is same as extension id - no need to update menu item
- $isUpdate = ($menuItem && $menuItem->component_id == $extensionId) ? false : true;
-
- if (!$isUpdate)
- {
- return;
- }
-
- $query->clear()
- ->update($db->qn('#__menu'))
- ->set($db->qn('component_id') . ' = ' . (int) $extensionId)
- ->where($db->qn('menutype') . ' = ' . $db->quote('main'))
- ->where($db->qn('path') . ' LIKE ' . $db->quote('%redshop'))
- ->where($db->qn('type') . ' = ' . $db->quote('component'));
-
- // Set the query and execute the update.
- $db->setQuery($query)->execute();
- }
+ /**
+ * Method for rename image files name to correct format.
+ *
+ * @return void
+ *
+ * @since 2.0.4
+ */
+ public function updateImageFileNames()
+ {
+ $db = JFactory::getDbo();
+
+ /** Update DB */
+ $fields = array(
+ $db->qn('product_full_image') . ' = REPLACE(' . $db->qn('product_full_image') . ", '%20', '-')",
+ $db->qn('product_full_image') . ' = REPLACE(' . $db->qn('product_full_image') . ", ' ', '-')",
+ $db->qn('product_thumb_image') . ' = REPLACE(' . $db->qn('product_thumb_image') . ", '%20', '-')",
+ $db->qn('product_thumb_image') . ' = REPLACE(' . $db->qn('product_thumb_image') . ", ' ', '-')"
+ );
+
+ $query = $db->getQuery(true)
+ ->update($db->qn('#__redshop_product'))
+ ->set($fields);
+ $db->setQuery($query)->execute();
+
+ /** Update Image Name */
+ $files = JFolder::files(JPATH_SITE . '/components/com_redshop/assets/images/product/');
+ $this->changeImageFileName($files, $path);
+
+ $files = JFolder::files(JPATH_SITE . '/components/com_redshop/assets/images/product/thumb/');
+ $this->changeImageFileName($files, $path);
+ }
+
+ /**
+ * Change images file name
+ *
+ * @param array $files List files in image folder
+ * @param string $path Path to folder
+ *
+ * @return void
+ */
+ protected function changeImageFileName(&$files, &$path)
+ {
+ if (empty($files)) {
+ return;
+ }
+
+ foreach ($files as $file) {
+ $fileName = str_replace(array('%20', ' '), '-', $file);
+
+ JFile::move($path . $file, $path . $fileName);
+ }
+ }
+
+ /**
+ * Method for update menu item id if necessary.
+ *
+ * @return void
+ *
+ * @since 2.0.4
+ */
+ public function updateMenuItem()
+ {
+ $db = JFactory::getDbo();
+
+ // For Blank component id in menu table-admin menu error solution - Get redSHOP extension id from the table
+ $query = $db->getQuery(true)
+ ->select('extension_id')
+ ->from($db->qn('#__extensions'))
+ ->where($db->qn('name') . ' LIKE ' . $db->quote('%redshop'))
+ ->where($db->qn('element') . ' = ' . $db->quote('com_redshop'))
+ ->where($db->qn('type') . ' = ' . $db->quote('component'));
+
+ $extensionId = $db->setQuery($query)->loadResult();
+
+ // Check for component menu item entry
+ $query->clear()
+ ->select('id,component_id')
+ ->from($db->qn('#__menu'))
+ ->where($db->qn('menutype') . ' = ' . $db->quote('main'))
+ ->where($db->qn('path') . ' LIKE ' . $db->quote('%redshop'))
+ ->where($db->qn('type') . ' = ' . $db->quote('component'));
+
+ $menuItem = $db->setQuery($query)->loadObject();
+
+ // If component Entry found and component_id is same as extension id - no need to update menu item
+ $isUpdate = ($menuItem && $menuItem->component_id == $extensionId) ? false : true;
+
+ if (!$isUpdate) {
+ return;
+ }
+
+ $query->clear()
+ ->update($db->qn('#__menu'))
+ ->set($db->qn('component_id') . ' = ' . (int)$extensionId)
+ ->where($db->qn('menutype') . ' = ' . $db->quote('main'))
+ ->where($db->qn('path') . ' LIKE ' . $db->quote('%redshop'))
+ ->where($db->qn('type') . ' = ' . $db->quote('component'));
+
+ // Set the query and execute the update.
+ $db->setQuery($query)->execute();
+ }
+
+ /**
+ * Return list of old files for clean
+ *
+ * @return array
+ *
+ * @since 2.0.4
+ */
+ protected function getOldFiles()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/update.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redshopupdate.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/update.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/tax_group_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/tax_group_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/tax_group_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/tax_group/tmpl/default.php',
+ JPATH_SITE . '/libraries/redshop/install/database.php'
+ );
+ }
+
+ /**
+ * Return list of old folders for clean
+ *
+ * @return array
+ *
+ * @since 2.0.4
+ */
+ protected function getOldFolders()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/update',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/extras/sh404sef/sef_ext',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/extras/sh404sef/meta_ext',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/barcode',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/tax_group_detail'
+ );
+ }
}
diff --git a/component/admin/updates/2.0.6.php b/component/admin/updates/2.0.6.php
index a1662f5124d..d23ca44fc1e 100644
--- a/component/admin/updates/2.0.6.php
+++ b/component/admin/updates/2.0.6.php
@@ -18,147 +18,147 @@
*/
class RedshopUpdate206 extends RedshopInstallUpdate
{
- /**
- * Return list of old files for clean
- *
- * @return array
- *
- * @since 2.0.6
- */
- protected function getOldFiles()
- {
- return array(
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/accessmanager.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/accessmanager_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redaccesslevel.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/thumbnail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/accessmanager.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/accessmanager_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/accessmanager_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/category_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/category_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/fields_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/fields_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/fields_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/configuration/tmpl/default_analytics.php'
- );
- }
-
- /**
- * Return list of old folders for clean
- *
- * @return array
- *
- * @since 2.0.6
- */
- protected function getOldFolders()
- {
- return array(
- JPATH_LIBRARIES . '/redshop/economic',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/accessmanager',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/accessmanager_detail',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/category_detail',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/fields_detail'
- );
- }
-
- /**
- * Method to update new structure for Category
- *
- * @return void
- *
- * @since 2.0.6
- */
- public function updateCategory()
- {
- $db = JFactory::getDbo();
- $check = RedshopHelperCategory::getRootId();
-
- if (!empty($check))
- {
- return;
- }
-
- $root = new stdClass;
- $root->name = 'ROOT';
- $root->parent_id = 0;
- $root->level = 0;
- $root->lft = 0;
- $root->rgt = 1;
- $root->published = 1;
- $db->insertObject('#__redshop_category', $root);
-
- $rootId = $db->insertid();
-
- $query = $db->getQuery(true)
- ->select('c.*')
- ->select($db->qn('cx.category_parent_id', 'parent_id'))
- ->from($db->qn('#__redshop_category', 'c'))
- ->leftJoin($db->qn('#__redshop_category_xref', 'cx') . ' ON ' . $db->qn('c.id') . ' = ' . $db->qn('cx.category_child_id'));
- $categories = $db->setQuery($query)->loadObjectList();
-
- foreach ($categories as $key => $category)
- {
- if ($category->name == 'ROOT')
- {
- continue;
- }
-
- $parentId = ($category->parent_id == 0) ? $rootId : $category->parent_id;
- $alias = JFilterOutput::stringUrlUnicodeSlug($category->name);
-
- $fields = array(
- $db->qn('parent_id') . ' = ' . $db->q((int) $parentId),
- $db->qn('alias') . ' = ' . $db->q($alias)
- );
-
- $conditions = array(
- $db->qn('id') . ' = ' . $db->q((int) $category->id)
- );
-
- $query = $db->getQuery(true)
- ->update($db->qn('#__redshop_category'))
- ->set($fields)
- ->where($conditions);
-
- $db->setQuery($query)->execute();
- }
-
- if ($this->processRebuildCategory($rootId))
- {
- $this->processDeleteCategoryXrefTable();
- }
- }
-
- /**
- * Method to update new structure for Category
- *
- * @param int $rootId Root ID
- *
- * @return mixed
- *
- * @since 2.0.6
- */
- protected function processRebuildCategory($rootId)
- {
- /** @var RedshopTableCategory $table */
- $table = RedshopTable::getInstance('Category', 'RedshopTable');
-
- return $table->rebuild($rootId);
- }
-
- /**
- * Method to update new structure for Category
- *
- * @return mixed
- *
- * @since 2.0.6
- */
- protected function processDeleteCategoryXrefTable()
- {
- $db = JFactory::getDbo();
-
- return $db->setQuery('DROP TABLE IF EXISTS ' . $db->qn('#__redshop_category_xref'))
- ->execute();
- }
+ /**
+ * Method to update new structure for Category
+ *
+ * @return void
+ *
+ * @since 2.0.6
+ */
+ public function updateCategory()
+ {
+ $db = JFactory::getDbo();
+ $check = RedshopHelperCategory::getRootId();
+
+ if (!empty($check)) {
+ return;
+ }
+
+ $root = new stdClass;
+ $root->name = 'ROOT';
+ $root->parent_id = 0;
+ $root->level = 0;
+ $root->lft = 0;
+ $root->rgt = 1;
+ $root->published = 1;
+ $db->insertObject('#__redshop_category', $root);
+
+ $rootId = $db->insertid();
+
+ $query = $db->getQuery(true)
+ ->select('c.*')
+ ->select($db->qn('cx.category_parent_id', 'parent_id'))
+ ->from($db->qn('#__redshop_category', 'c'))
+ ->leftJoin(
+ $db->qn('#__redshop_category_xref', 'cx') . ' ON ' . $db->qn('c.id') . ' = ' . $db->qn(
+ 'cx.category_child_id'
+ )
+ );
+ $categories = $db->setQuery($query)->loadObjectList();
+
+ foreach ($categories as $key => $category) {
+ if ($category->name == 'ROOT') {
+ continue;
+ }
+
+ $parentId = ($category->parent_id == 0) ? $rootId : $category->parent_id;
+ $alias = JFilterOutput::stringUrlUnicodeSlug($category->name);
+
+ $fields = array(
+ $db->qn('parent_id') . ' = ' . $db->q((int)$parentId),
+ $db->qn('alias') . ' = ' . $db->q($alias)
+ );
+
+ $conditions = array(
+ $db->qn('id') . ' = ' . $db->q((int)$category->id)
+ );
+
+ $query = $db->getQuery(true)
+ ->update($db->qn('#__redshop_category'))
+ ->set($fields)
+ ->where($conditions);
+
+ $db->setQuery($query)->execute();
+ }
+
+ if ($this->processRebuildCategory($rootId)) {
+ $this->processDeleteCategoryXrefTable();
+ }
+ }
+
+ /**
+ * Method to update new structure for Category
+ *
+ * @param int $rootId Root ID
+ *
+ * @return mixed
+ *
+ * @since 2.0.6
+ */
+ protected function processRebuildCategory($rootId)
+ {
+ /** @var RedshopTableCategory $table */
+ $table = RedshopTable::getInstance('Category', 'RedshopTable');
+
+ return $table->rebuild($rootId);
+ }
+
+ /**
+ * Method to update new structure for Category
+ *
+ * @return mixed
+ *
+ * @since 2.0.6
+ */
+ protected function processDeleteCategoryXrefTable()
+ {
+ $db = JFactory::getDbo();
+
+ return $db->setQuery('DROP TABLE IF EXISTS ' . $db->qn('#__redshop_category_xref'))
+ ->execute();
+ }
+
+ /**
+ * Return list of old files for clean
+ *
+ * @return array
+ *
+ * @since 2.0.6
+ */
+ protected function getOldFiles()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/accessmanager.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/accessmanager_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/redaccesslevel.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/helpers/thumbnail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/accessmanager.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/accessmanager_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/accessmanager_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/category_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/category_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/fields_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/fields_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/fields_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/configuration/tmpl/default_analytics.php'
+ );
+ }
+
+ /**
+ * Return list of old folders for clean
+ *
+ * @return array
+ *
+ * @since 2.0.6
+ */
+ protected function getOldFolders()
+ {
+ return array(
+ JPATH_LIBRARIES . '/redshop/economic',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/accessmanager',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/accessmanager_detail',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/category_detail',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/fields_detail'
+ );
+ }
}
diff --git a/component/admin/updates/2.0.7.php b/component/admin/updates/2.0.7.php
index 4bee460afc6..73669a318b5 100644
--- a/component/admin/updates/2.0.7.php
+++ b/component/admin/updates/2.0.7.php
@@ -18,122 +18,122 @@
*/
class RedshopUpdate207 extends RedshopInstallUpdate
{
- /**
- * Return list of old files for clean
- *
- * @return array
- *
- * @since 2.0.7
- */
- protected function getOldFiles()
- {
- return array(
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/voucher_detail.php',
- JPATH_ADMINISTRATOR . '/component/com_redshop/views/voucher/tmpl/default.php',
- JPATH_ADMINISTRATOR . '/component/com_redshop/models/voucher_detail.php',
- JPATH_ADMINISTRATOR . '/component/com_redshop/controllers/voucher_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/mail_detail.php',
- JPATH_ADMINISTRATOR . '/component/com_redshop/views/mail/tmpl/default.php',
- JPATH_ADMINISTRATOR . '/component/com_redshop/models/mail_detail.php',
- JPATH_ADMINISTRATOR . '/component/com_redshop/controllers/mail_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/template_detail.php',
- JPATH_ADMINISTRATOR . '/component/com_redshop/views/template/tmpl/default.php',
- JPATH_ADMINISTRATOR . '/component/com_redshop/models/template_detail.php',
- JPATH_ADMINISTRATOR . '/component/com_redshop/controllers/template_detail.php',
- JPATH_LIBRARIES . '/redshop/helper/route.php'
- );
- }
-
- /**
- * Return list of old folders for clean
- *
- * @return array
- *
- * @since 2.0.7
- */
- protected function getOldFolders()
- {
- return array(
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/voucher_detail',
- JPATH_SITE . '/components/com_redshop/layouts/tags',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/mail_detail',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/template_detail'
- );
- }
-
- /**
- * Method for migrate voucher data to new table
- *
- * @return void
- *
- * @since 2.0.7
- */
- public function migrateVoucher()
- {
- $db = JFactory::getDbo();
-
- // Check table exist.
- $result = $db->setQuery("SHOW TABLES LIKE " . $db->quote('#__redshop_product_voucher'))->loadResult();
-
- if (empty($result))
- {
- return;
- }
-
- $query = $db->getQuery(true)
- ->select('*')
- ->from($db->qn('#__redshop_product_voucher'))
- ->order($db->qn('voucher_id'));
-
- $vouchers = $db->setQuery($query)->loadObjectList();
-
- if (empty($vouchers))
- {
- $this->dropOldTable();
-
- return;
- }
-
- $table = RedshopTable::getAdminInstance('Voucher');
- $table->setOption('skip.checkPrimary', true);
- $table->setOption('skip.updateProducts', true);
-
- foreach ($vouchers as $voucher)
- {
- $data = (array) $voucher;
-
- $data['id'] = $data['voucher_id'];
- $data['code'] = $data['voucher_code'];
- $data['type'] = $data['voucher_type'];
- $data['free_ship'] = $data['free_shipping'];
- $data['start_date'] = !$data['start_date'] ? '0000-00-00 00:00:00' : JFactory::getDate($data['start_date'])->format('Y-m-d H:i:s');
- $data['end_date'] = !$data['end_date'] ? '0000-00-00 00:00:00' : JFactory::getDate($data['end_date'])->format('Y-m-d H:i:s');
-
- unset($data['voucher_id']);
- unset($data['voucher_code']);
- unset($data['voucher_type']);
- unset($data['free_shipping']);
-
- if (!$table->save($data))
- {
- JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
- }
- }
-
- $this->dropOldTable();
- }
-
- /**
- * Method for drop old `#__redshop_product_voucher` table.
- *
- * @return void
- *
- * @since 2.0.7
- */
- protected function dropOldTable()
- {
- $db = JFactory::getDbo();
-
- $db->setQuery('DROP TABLE IF EXISTS ' . $db->qn('#__redshop_product_voucher'))->execute();
- }
+ /**
+ * Method for migrate voucher data to new table
+ *
+ * @return void
+ *
+ * @since 2.0.7
+ */
+ public function migrateVoucher()
+ {
+ $db = JFactory::getDbo();
+
+ // Check table exist.
+ $result = $db->setQuery("SHOW TABLES LIKE " . $db->quote('#__redshop_product_voucher'))->loadResult();
+
+ if (empty($result)) {
+ return;
+ }
+
+ $query = $db->getQuery(true)
+ ->select('*')
+ ->from($db->qn('#__redshop_product_voucher'))
+ ->order($db->qn('voucher_id'));
+
+ $vouchers = $db->setQuery($query)->loadObjectList();
+
+ if (empty($vouchers)) {
+ $this->dropOldTable();
+
+ return;
+ }
+
+ $table = RedshopTable::getAdminInstance('Voucher');
+ $table->setOption('skip.checkPrimary', true);
+ $table->setOption('skip.updateProducts', true);
+
+ foreach ($vouchers as $voucher) {
+ $data = (array)$voucher;
+
+ $data['id'] = $data['voucher_id'];
+ $data['code'] = $data['voucher_code'];
+ $data['type'] = $data['voucher_type'];
+ $data['free_ship'] = $data['free_shipping'];
+ $data['start_date'] = !$data['start_date'] ? '0000-00-00 00:00:00' : JFactory::getDate(
+ $data['start_date']
+ )->format('Y-m-d H:i:s');
+ $data['end_date'] = !$data['end_date'] ? '0000-00-00 00:00:00' : JFactory::getDate(
+ $data['end_date']
+ )->format('Y-m-d H:i:s');
+
+ unset($data['voucher_id']);
+ unset($data['voucher_code']);
+ unset($data['voucher_type']);
+ unset($data['free_shipping']);
+
+ if (!$table->save($data)) {
+ JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
+ }
+ }
+
+ $this->dropOldTable();
+ }
+
+ /**
+ * Method for drop old `#__redshop_product_voucher` table.
+ *
+ * @return void
+ *
+ * @since 2.0.7
+ */
+ protected function dropOldTable()
+ {
+ $db = JFactory::getDbo();
+
+ $db->setQuery('DROP TABLE IF EXISTS ' . $db->qn('#__redshop_product_voucher'))->execute();
+ }
+
+ /**
+ * Return list of old files for clean
+ *
+ * @return array
+ *
+ * @since 2.0.7
+ */
+ protected function getOldFiles()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/voucher_detail.php',
+ JPATH_ADMINISTRATOR . '/component/com_redshop/views/voucher/tmpl/default.php',
+ JPATH_ADMINISTRATOR . '/component/com_redshop/models/voucher_detail.php',
+ JPATH_ADMINISTRATOR . '/component/com_redshop/controllers/voucher_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/mail_detail.php',
+ JPATH_ADMINISTRATOR . '/component/com_redshop/views/mail/tmpl/default.php',
+ JPATH_ADMINISTRATOR . '/component/com_redshop/models/mail_detail.php',
+ JPATH_ADMINISTRATOR . '/component/com_redshop/controllers/mail_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/template_detail.php',
+ JPATH_ADMINISTRATOR . '/component/com_redshop/views/template/tmpl/default.php',
+ JPATH_ADMINISTRATOR . '/component/com_redshop/models/template_detail.php',
+ JPATH_ADMINISTRATOR . '/component/com_redshop/controllers/template_detail.php',
+ JPATH_LIBRARIES . '/redshop/helper/route.php'
+ );
+ }
+
+ /**
+ * Return list of old folders for clean
+ *
+ * @return array
+ *
+ * @since 2.0.7
+ */
+ protected function getOldFolders()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/voucher_detail',
+ JPATH_SITE . '/components/com_redshop/layouts/tags',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/mail_detail',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/template_detail'
+ );
+ }
}
diff --git a/component/admin/updates/2.0.9.php b/component/admin/updates/2.0.9.php
index 209cfb79eec..c7078867ea5 100644
--- a/component/admin/updates/2.0.9.php
+++ b/component/admin/updates/2.0.9.php
@@ -18,303 +18,292 @@
*/
class RedshopUpdate209 extends RedshopInstallUpdate
{
- /**
- * Return list of old files for clean
- *
- * @return array
- *
- * @since 2.0.9
- */
- protected function getOldFiles()
- {
- return array();
- }
-
- /**
- * Return list of old folders for clean
- *
- * @return array
- *
- * @since 2.0.9
- */
- protected function getOldFolders()
- {
- return array(
- JPATH_SITE . '/components/com_redshop/templates'
- );
- }
-
- /**
- * Method for migrate voucher data to new table
- *
- * @return void
- * @throws Exception
- *
- * @since 2.0.9
- */
- public function migrateTemplateFiles()
- {
- $db = JFactory::getDbo();
-
- $query = $db->getQuery(true)
- ->select('*')
- ->from($db->qn('#__redshop_template'))
- ->order($db->qn('section'));
-
- $templates = $db->setQuery($query)->loadObjectList();
-
- if (empty($templates))
- {
- return;
- }
-
- $templates = $this->migrateOldTemplate($templates);
-
- if (empty($templates))
- {
- return;
- }
-
- $this->migrateOverrideTemplate($templates);
- }
-
- /**
- * Template View selector
- *
- * @param array $templates Templates
- *
- * @return array List of template table which already migrate correct data.
- *
- * @since 2.0.9
- */
- protected function migrateOldTemplate($templates = array())
- {
- $oldPaths = array();
- $tables = array();
-
- // Copy old template files to new structure.
- foreach ($templates as $template)
- {
- /** @var RedshopTableTemplate $table */
- $table = RedshopTable::getAdminInstance('Template', array('ignore_request' => true), 'com_redshop');
- $table->bind((array) $template);
-
- // Skip if template already migrate
- if (!empty($template->file_name))
- {
- $tables[] = $table;
-
- continue;
- }
-
- $table->file_name = $table->generateTemplateFileName($table->id, $table->name);
-
- if (!$table->store())
- {
- continue;
- }
-
- $view = $this->getTemplateView($template->section);
- $oldPaths[] = JPath::clean(JPATH_SITE . '/components/com_redshop/views/' . $view . '/tmpl/' . $template->section);
- $sourceFile = JPATH_SITE . '/components/com_redshop/views/' . $view . '/tmpl/' . $template->section . '/' . $template->name . '.php';
- $sourceFile = JPath::clean($sourceFile);
-
- if (!JFile::exists($sourceFile))
- {
- $sourceFile = JPath::clean(JPATH_REDSHOP_TEMPLATE . '/' . $table->section . '/default.php');
- }
-
- $targetFile = JPath::clean(JPATH_REDSHOP_TEMPLATE . '/' . $table->section . '/' . $table->file_name . '.php');
-
- if (JFile::exists($sourceFile))
- {
- if (JFile::exists($targetFile))
- {
- JFile::delete($targetFile);
- }
-
- JFile::copy($sourceFile, $targetFile);
- }
-
- $tables[] = $table;
- }
-
- // Delete old folders.
- $oldPaths = array_unique($oldPaths);
-
- foreach ($oldPaths as $path)
- {
- if (JFolder::exists($path))
- {
- JFolder::delete($path);
- }
- }
-
- return $tables;
- }
-
- /**
- * Template View selector
- *
- * @param array $templates Templates
- *
- * @return void
- * @throws Exception
- *
- * @since 2.0.9
- */
- protected function migrateOverrideTemplate($templates = array())
- {
- $joomlaTemplate = $this->getActiveSiteTemplate();
-
- foreach ($templates as $template)
- {
- /** @var RedshopTableTemplate $template */
- $view = $this->getTemplateView($template->section);
- $overrideFile = JPATH_SITE . '/templates/' . $joomlaTemplate . '/html/com_redshop/';
-
- if ($template->section != 'categoryproduct')
- {
- $overrideFile .= $view . '/' . $template->section . '/' . $template->name . '.php';
- }
- else
- {
- $overrideFile .= $template->section . '/' . $template->name . '.php';
- }
-
- $overrideFile = JPath::clean($overrideFile);
-
- if (!JFile::exists($overrideFile))
- {
- continue;
- }
-
- $target = JPath::clean(JPATH_REDSHOP_TEMPLATE . '/' . $template->section . '/' . $template->file_name . '.php');
-
- if (JFile::exists($target))
- {
- JFile::delete($target);
- }
-
- JFile::move($overrideFile, $target);
- }
- }
-
- /**
- * Template View selector
- *
- * @param string $section Template section
- *
- * @return string Template Joomla view name
- *
- * @since 2.0.9
- */
- protected function getTemplateView($section)
- {
- $section = strtolower($section);
-
- switch ($section)
- {
- case 'product':
- case 'related_product':
- case 'product_sample':
- case 'accessory_template':
- case 'attribute_template':
- case 'attributewithcart_template':
- case 'review':
- case 'wrapper_template':
- case 'compare_product':
- $view = "product";
- break;
-
- case 'categoryproduct':
- case 'category':
- case 'frontpage_category':
- $view = "category";
- break;
-
- case 'catalog':
- case 'catalog_sample':
- $view = "catalog";
- break;
-
- case 'manufacturer':
- case 'manufacturer_detail':
- case 'manufacturer_products':
-
- $view = "manufacturers";
- break;
- case 'cart':
- case 'add_to_cart':
- case 'ajax_cart_detail_box':
- case 'ajax_cart_box':
- case 'empty_cart':
- $view = "cart";
- break;
-
- case 'account_template':
- $view = "account";
- break;
-
- case 'private_billing_template':
- case 'company_billing_template':
- case 'billing_template':
- case 'shipping_template':
- $view = "registration";
- break;
-
- case 'wishlist_template':
- case 'wishlist_mail_template':
- $view = "wishlist";
- break;
-
- case 'newsletter':
- case 'newsletter_product':
- $view = "newsletter";
- break;
-
- case 'order_list':
- case 'order_detail':
- case 'order_receipt':
- $view = "orders";
- break;
-
- case 'giftcard':
- $view = "giftcard";
- break;
-
- case 'checkout':
- case 'onestep_checkout':
- $view = "checkout";
- break;
-
- case 'ask_question_template':
- $view = "ask_question";
- break;
-
- default:
- return '';
- }
-
- return $view;
- }
-
- /**
- * Method for get "default" template use on Front-end
- *
- * @return string
- *
- * @since 2.0.9
- */
- protected function getActiveSiteTemplate()
- {
- $db = JFactory::getDbo();
- $query = $db->getQuery(true)
- ->select($db->qn('template'))
- ->from($db->qn('#__template_styles'))
- ->where($db->qn('client_id') . ' = 0')
- ->where($db->qn('home') . ' = 1');
-
- return $db->setQuery($query)->loadResult();
- }
+ /**
+ * Method for migrate voucher data to new table
+ *
+ * @return void
+ * @throws Exception
+ *
+ * @since 2.0.9
+ */
+ public function migrateTemplateFiles()
+ {
+ $db = JFactory::getDbo();
+
+ $query = $db->getQuery(true)
+ ->select('*')
+ ->from($db->qn('#__redshop_template'))
+ ->order($db->qn('section'));
+
+ $templates = $db->setQuery($query)->loadObjectList();
+
+ if (empty($templates)) {
+ return;
+ }
+
+ $templates = $this->migrateOldTemplate($templates);
+
+ if (empty($templates)) {
+ return;
+ }
+
+ $this->migrateOverrideTemplate($templates);
+ }
+
+ /**
+ * Template View selector
+ *
+ * @param array $templates Templates
+ *
+ * @return array List of template table which already migrate correct data.
+ *
+ * @since 2.0.9
+ */
+ protected function migrateOldTemplate($templates = array())
+ {
+ $oldPaths = array();
+ $tables = array();
+
+ // Copy old template files to new structure.
+ foreach ($templates as $template) {
+ /** @var RedshopTableTemplate $table */
+ $table = RedshopTable::getAdminInstance('Template', array('ignore_request' => true), 'com_redshop');
+ $table->bind((array)$template);
+
+ // Skip if template already migrate
+ if (!empty($template->file_name)) {
+ $tables[] = $table;
+
+ continue;
+ }
+
+ $table->file_name = $table->generateTemplateFileName($table->id, $table->name);
+
+ if (!$table->store()) {
+ continue;
+ }
+
+ $view = $this->getTemplateView($template->section);
+ $oldPaths[] = JPath::clean(
+ JPATH_SITE . '/components/com_redshop/views/' . $view . '/tmpl/' . $template->section
+ );
+ $sourceFile = JPATH_SITE . '/components/com_redshop/views/' . $view . '/tmpl/' . $template->section . '/' . $template->name . '.php';
+ $sourceFile = JPath::clean($sourceFile);
+
+ if (!JFile::exists($sourceFile)) {
+ $sourceFile = JPath::clean(JPATH_REDSHOP_TEMPLATE . '/' . $table->section . '/default.php');
+ }
+
+ $targetFile = JPath::clean(
+ JPATH_REDSHOP_TEMPLATE . '/' . $table->section . '/' . $table->file_name . '.php'
+ );
+
+ if (JFile::exists($sourceFile)) {
+ if (JFile::exists($targetFile)) {
+ JFile::delete($targetFile);
+ }
+
+ JFile::copy($sourceFile, $targetFile);
+ }
+
+ $tables[] = $table;
+ }
+
+ // Delete old folders.
+ $oldPaths = array_unique($oldPaths);
+
+ foreach ($oldPaths as $path) {
+ if (JFolder::exists($path)) {
+ JFolder::delete($path);
+ }
+ }
+
+ return $tables;
+ }
+
+ /**
+ * Template View selector
+ *
+ * @param string $section Template section
+ *
+ * @return string Template Joomla view name
+ *
+ * @since 2.0.9
+ */
+ protected function getTemplateView($section)
+ {
+ $section = strtolower($section);
+
+ switch ($section) {
+ case 'product':
+ case 'related_product':
+ case 'product_sample':
+ case 'accessory_template':
+ case 'attribute_template':
+ case 'attributewithcart_template':
+ case 'review':
+ case 'wrapper_template':
+ case 'compare_product':
+ $view = "product";
+ break;
+
+ case 'categoryproduct':
+ case 'category':
+ case 'frontpage_category':
+ $view = "category";
+ break;
+
+ case 'catalog':
+ case 'catalog_sample':
+ $view = "catalog";
+ break;
+
+ case 'manufacturer':
+ case 'manufacturer_detail':
+ case 'manufacturer_products':
+
+ $view = "manufacturers";
+ break;
+ case 'cart':
+ case 'add_to_cart':
+ case 'ajax_cart_detail_box':
+ case 'ajax_cart_box':
+ case 'empty_cart':
+ $view = "cart";
+ break;
+
+ case 'account_template':
+ $view = "account";
+ break;
+
+ case 'private_billing_template':
+ case 'company_billing_template':
+ case 'billing_template':
+ case 'shipping_template':
+ $view = "registration";
+ break;
+
+ case 'wishlist_template':
+ case 'wishlist_mail_template':
+ $view = "wishlist";
+ break;
+
+ case 'newsletter':
+ case 'newsletter_product':
+ $view = "newsletter";
+ break;
+
+ case 'order_list':
+ case 'order_detail':
+ case 'order_receipt':
+ $view = "orders";
+ break;
+
+ case 'giftcard':
+ $view = "giftcard";
+ break;
+
+ case 'checkout':
+ case 'onestep_checkout':
+ $view = "checkout";
+ break;
+
+ case 'ask_question_template':
+ $view = "ask_question";
+ break;
+
+ default:
+ return '';
+ }
+
+ return $view;
+ }
+
+ /**
+ * Template View selector
+ *
+ * @param array $templates Templates
+ *
+ * @return void
+ * @throws Exception
+ *
+ * @since 2.0.9
+ */
+ protected function migrateOverrideTemplate($templates = array())
+ {
+ $joomlaTemplate = $this->getActiveSiteTemplate();
+
+ foreach ($templates as $template) {
+ /** @var RedshopTableTemplate $template */
+ $view = $this->getTemplateView($template->section);
+ $overrideFile = JPATH_SITE . '/templates/' . $joomlaTemplate . '/html/com_redshop/';
+
+ if ($template->section != 'categoryproduct') {
+ $overrideFile .= $view . '/' . $template->section . '/' . $template->name . '.php';
+ } else {
+ $overrideFile .= $template->section . '/' . $template->name . '.php';
+ }
+
+ $overrideFile = JPath::clean($overrideFile);
+
+ if (!JFile::exists($overrideFile)) {
+ continue;
+ }
+
+ $target = JPath::clean(
+ JPATH_REDSHOP_TEMPLATE . '/' . $template->section . '/' . $template->file_name . '.php'
+ );
+
+ if (JFile::exists($target)) {
+ JFile::delete($target);
+ }
+
+ JFile::move($overrideFile, $target);
+ }
+ }
+
+ /**
+ * Method for get "default" template use on Front-end
+ *
+ * @return string
+ *
+ * @since 2.0.9
+ */
+ protected function getActiveSiteTemplate()
+ {
+ $db = JFactory::getDbo();
+ $query = $db->getQuery(true)
+ ->select($db->qn('template'))
+ ->from($db->qn('#__template_styles'))
+ ->where($db->qn('client_id') . ' = 0')
+ ->where($db->qn('home') . ' = 1');
+
+ return $db->setQuery($query)->loadResult();
+ }
+
+ /**
+ * Return list of old files for clean
+ *
+ * @return array
+ *
+ * @since 2.0.9
+ */
+ protected function getOldFiles()
+ {
+ return array();
+ }
+
+ /**
+ * Return list of old folders for clean
+ *
+ * @return array
+ *
+ * @since 2.0.9
+ */
+ protected function getOldFolders()
+ {
+ return array(
+ JPATH_SITE . '/components/com_redshop/templates'
+ );
+ }
}
diff --git a/component/admin/updates/2.1.0.php b/component/admin/updates/2.1.0.php
index 414c79fa4b5..917ae9b1c06 100644
--- a/component/admin/updates/2.1.0.php
+++ b/component/admin/updates/2.1.0.php
@@ -18,117 +18,114 @@
*/
class RedshopUpdate210 extends RedshopInstallUpdate
{
- /**
- * Return list of old files for clean
- *
- * @return array
- *
- * @since 2.1.0
- */
- protected function getOldFiles()
- {
- return array(
- // Old coupon files
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/coupon_detail.php',
- JPATH_ADMINISTRATOR . '/component/com_redshop/views/coupon/tmpl/default.php',
- JPATH_ADMINISTRATOR . '/component/com_redshop/models/coupon_detail.php',
- JPATH_ADMINISTRATOR . '/component/com_redshop/controllers/coupon_detail.php',
- // Old shipping box files
- JPATH_ADMINISTRATOR . '/component/com_redshop/controllers/shipping_box_detail.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/tables/shipping_box_detail.php',
- JPATH_ADMINISTRATOR . '/component/com_redshop/views/shipping_box/tmpl/default.php',
- JPATH_ADMINISTRATOR . '/component/com_redshop/models/shipping_box_detail.php',
- // Old address field files
- JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/addressfields_listing.php',
- JPATH_ADMINISTRATOR . '/components/com_redshop/models/addressfields_listing.php',
- JPATH_LIBRARIES . '/redshop/src/Economic/Economic.php'
- );
- }
-
- /**
- * Return list of old folders for clean
- *
- * @return array
- *
- * @since 2.1.0
- */
- protected function getOldFolders()
- {
- return array(
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/addressfields_listing',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/coupon_detail',
- JPATH_ADMINISTRATOR . '/components/com_redshop/views/shipping_box_detail',
- JPATH_ADMINISTRATOR . '/components/com_redshop/assets/js',
- JPATH_ADMINISTRATOR . '/components/com_redshop/assets/css',
- JPATH_ADMINISTRATOR . '/components/com_redshop/assets/images'
- );
- }
-
- /**
- * Method for migrate voucher data to new table
- *
- * @return void
- *
- * @since 2.1.0
- *
- * @throws Exception
- */
- public function migrateCoupons()
- {
- $db = JFactory::getDbo();
-
- $query = $db->getQuery(true)
- ->select('*')
- ->from($db->qn('#__redshop_coupons'))
- ->order($db->qn('id'));
-
- $coupons = $db->setQuery($query)->loadObjectList();
-
- if (empty($coupons))
- {
- return;
- }
-
- $nullDate = $db->getNullDate();
-
- foreach ($coupons as $coupon)
- {
- /** @var RedshopTableCoupon $table */
- $table = RedshopTable::getAdminInstance('Coupon');
-
- if (!$table->load($coupon->id))
- {
- continue;
- }
-
- $needUpdate = false;
-
- if ($table->start_date == $nullDate && !empty($coupon->start_date_old))
- {
- $table->start_date = JFactory::getDate($coupon->start_date_old)->toSql();
- $needUpdate = true;
- }
-
- if ($table->end_date == $nullDate && !empty($coupon->end_date_old))
- {
- $table->end_date = JFactory::getDate($coupon->end_date_old)->toSql();
- $needUpdate = true;
- }
-
- if (!$needUpdate)
- {
- continue;
- }
-
- if (!$table->store())
- {
- JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
- }
- }
-
- $query = 'CALL redSHOP_Column_Remove(' . $db->quote('#__redshop_coupons') . ',' . $db->quote('start_date_old') . ');';
- $db->setQuery($query)->execute();
- $query = 'CALL redSHOP_Column_Remove(' . $db->quote('#__redshop_coupons') . ',' . $db->quote('end_date_old') . ');';
- $db->setQuery($query)->execute();
- }
+ /**
+ * Method for migrate voucher data to new table
+ *
+ * @return void
+ *
+ * @throws Exception
+ * @since 2.1.0
+ *
+ */
+ public function migrateCoupons()
+ {
+ $db = JFactory::getDbo();
+
+ $query = $db->getQuery(true)
+ ->select('*')
+ ->from($db->qn('#__redshop_coupons'))
+ ->order($db->qn('id'));
+
+ $coupons = $db->setQuery($query)->loadObjectList();
+
+ if (empty($coupons)) {
+ return;
+ }
+
+ $nullDate = $db->getNullDate();
+
+ foreach ($coupons as $coupon) {
+ /** @var RedshopTableCoupon $table */
+ $table = RedshopTable::getAdminInstance('Coupon');
+
+ if (!$table->load($coupon->id)) {
+ continue;
+ }
+
+ $needUpdate = false;
+
+ if ($table->start_date == $nullDate && !empty($coupon->start_date_old)) {
+ $table->start_date = JFactory::getDate($coupon->start_date_old)->toSql();
+ $needUpdate = true;
+ }
+
+ if ($table->end_date == $nullDate && !empty($coupon->end_date_old)) {
+ $table->end_date = JFactory::getDate($coupon->end_date_old)->toSql();
+ $needUpdate = true;
+ }
+
+ if (!$needUpdate) {
+ continue;
+ }
+
+ if (!$table->store()) {
+ JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
+ }
+ }
+
+ $query = 'CALL redSHOP_Column_Remove(' . $db->quote('#__redshop_coupons') . ',' . $db->quote(
+ 'start_date_old'
+ ) . ');';
+ $db->setQuery($query)->execute();
+ $query = 'CALL redSHOP_Column_Remove(' . $db->quote('#__redshop_coupons') . ',' . $db->quote(
+ 'end_date_old'
+ ) . ');';
+ $db->setQuery($query)->execute();
+ }
+
+ /**
+ * Return list of old files for clean
+ *
+ * @return array
+ *
+ * @since 2.1.0
+ */
+ protected function getOldFiles()
+ {
+ return array(
+ // Old coupon files
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/coupon_detail.php',
+ JPATH_ADMINISTRATOR . '/component/com_redshop/views/coupon/tmpl/default.php',
+ JPATH_ADMINISTRATOR . '/component/com_redshop/models/coupon_detail.php',
+ JPATH_ADMINISTRATOR . '/component/com_redshop/controllers/coupon_detail.php',
+ // Old shipping box files
+ JPATH_ADMINISTRATOR . '/component/com_redshop/controllers/shipping_box_detail.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/tables/shipping_box_detail.php',
+ JPATH_ADMINISTRATOR . '/component/com_redshop/views/shipping_box/tmpl/default.php',
+ JPATH_ADMINISTRATOR . '/component/com_redshop/models/shipping_box_detail.php',
+ // Old address field files
+ JPATH_ADMINISTRATOR . '/components/com_redshop/controllers/addressfields_listing.php',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/models/addressfields_listing.php',
+ JPATH_LIBRARIES . '/redshop/src/Economic/Economic.php'
+ );
+ }
+
+ /**
+ * Return list of old folders for clean
+ *
+ * @return array
+ *
+ * @since 2.1.0
+ */
+ protected function getOldFolders()
+ {
+ return array(
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/addressfields_listing',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/coupon_detail',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/views/shipping_box_detail',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/assets/js',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/assets/css',
+ JPATH_ADMINISTRATOR . '/components/com_redshop/assets/images'
+ );
+ }
}
diff --git a/component/admin/updates/2.1.1.php b/component/admin/updates/2.1.1.php
index 28f3d11c2ac..7ceddd23e36 100644
--- a/component/admin/updates/2.1.1.php
+++ b/component/admin/updates/2.1.1.php
@@ -10,6 +10,7 @@
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
+
/**
* Update class
*
@@ -19,35 +20,33 @@
*/
class RedshopUpdate211 extends RedshopInstallUpdate
{
- /**
- * Method for fixing Calendar field not displaying properly when upgrade redshop
- * (happen when the DEFAULT_DATEFORMAT of old version is not assigned a format)
- *
- * @return void
- *
- * @since 2.1.1
- * @throws Exception
- */
- public function fixCalendarFormField()
- {
- $app = JFactory::getApplication();
- $currentConfig = Redshop::getConfig()->toArray();
+ /**
+ * Method for fixing Calendar field not displaying properly when upgrade redshop
+ * (happen when the DEFAULT_DATEFORMAT of old version is not assigned a format)
+ *
+ * @return void
+ *
+ * @throws Exception
+ * @since 2.1.1
+ */
+ public function fixCalendarFormField()
+ {
+ $app = JFactory::getApplication();
+ $currentConfig = Redshop::getConfig()->toArray();
- $temp = $app->getUserState('com_redshop.config.global.data');
+ $temp = $app->getUserState('com_redshop.config.global.data');
- if (!empty($temp))
- {
- $currentConfig = array_merge($currentConfig, $temp);
- }
+ if (!empty($temp)) {
+ $currentConfig = array_merge($currentConfig, $temp);
+ }
- if ($currentConfig['DEFAULT_DATEFORMAT'] === '0')
- {
- $currentConfig['DEFAULT_DATEFORMAT'] = 'Y-m-d';
- }
+ if ($currentConfig['DEFAULT_DATEFORMAT'] === '0') {
+ $currentConfig['DEFAULT_DATEFORMAT'] = 'Y-m-d';
+ }
- $config = Redshop::getConfig();
- $app->setUserState('com_redshop.config.global.data', $currentConfig);
- $data = new Registry($currentConfig);
- $config->save($data);
- }
+ $config = Redshop::getConfig();
+ $app->setUserState('com_redshop.config.global.data', $currentConfig);
+ $data = new Registry($currentConfig);
+ $config->save($data);
+ }
}
diff --git a/component/admin/updates/index.html b/component/admin/updates/index.html
index 94906bce29b..af1d3c9d43e 100644
--- a/component/admin/updates/index.html
+++ b/component/admin/updates/index.html
@@ -1 +1,3 @@
-
+
+
+
diff --git a/component/admin/views/access/index.html b/component/admin/views/access/index.html
index fa6d84e8055..1cbdf58d903 100644
--- a/component/admin/views/access/index.html
+++ b/component/admin/views/access/index.html
@@ -1 +1,3 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/component/admin/views/access/tmpl/default.php b/component/admin/views/access/tmpl/default.php
index ec0e920f422..5b7939782fa 100644
--- a/component/admin/views/access/tmpl/default.php
+++ b/component/admin/views/access/tmpl/default.php
@@ -1,4 +1,5 @@
-
\ No newline at end of file
diff --git a/component/admin/views/access/tmpl/index.html b/component/admin/views/access/tmpl/index.html
index fa6d84e8055..1cbdf58d903 100644
--- a/component/admin/views/access/tmpl/index.html
+++ b/component/admin/views/access/tmpl/index.html
@@ -1 +1,3 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/component/admin/views/access/view.html.php b/component/admin/views/access/view.html.php
index caaa21bd1cc..4a52575231f 100644
--- a/component/admin/views/access/view.html.php
+++ b/component/admin/views/access/view.html.php
@@ -17,62 +17,61 @@
* @subpackage View
* @since 2.0.6
*/
-
class RedshopViewAccess extends RedshopViewAdmin
{
- /**
- * @var JForm
- */
- protected $form;
+ /**
+ * @var JForm
+ */
+ protected $form;
- /**
- * @var object
- */
- protected $item;
+ /**
+ * @var object
+ */
+ protected $item;
- /**
- * @var array
- */
- protected $state;
+ /**
+ * @var array
+ */
+ protected $state;
- /**
- * Function display template
- *
- * @param string $tpl name of template
- *
- * @return void
- *
- * @since 2.0.6
- */
- public function display($tpl = null)
- {
- JToolBarHelper::title(JText::_('COM_REDSHOP_ACCESS_MANAGER'), 'redshop_country_48');
+ /**
+ * Function display template
+ *
+ * @param string $tpl name of template
+ *
+ * @return void
+ *
+ * @since 2.0.6
+ */
+ public function display($tpl = null)
+ {
+ JToolBarHelper::title(JText::_('COM_REDSHOP_ACCESS_MANAGER'), 'redshop_country_48');
- /** @var RedshopModelAccess $model */
- $model = $this->getModel();
+ /** @var RedshopModelAccess $model */
+ $model = $this->getModel();
- $this->item = $model->getItem();
- $this->form = $model->getForm();
- $this->state = $model->getState();
+ $this->item = $model->getItem();
+ $this->form = $model->getForm();
+ $this->state = $model->getState();
- $this->addToolBar();
+ $this->addToolBar();
- parent::display($tpl);
- }
+ parent::display($tpl);
+ }
- /**
- * Add the page title and toolbar.
- *
- * @return void
- *
- * @since 2.0.6
- */
- protected function addToolbar()
- {
- JFactory::getApplication()->input->set('hidemainmenu', true);
+ /**
+ * Add the page title and toolbar.
+ *
+ * @return void
+ *
+ * @since 2.0.6
+ */
+ protected function addToolbar()
+ {
+ JFactory::getApplication()->input->set('hidemainmenu', true);
- // Prepare text for title
- JToolBarHelper::title(JText::_('COM_REDSHOP_ACCESS_MANAGER'));
- JToolBarHelper::apply('access.save');
- }
+ // Prepare text for title
+ JToolBarHelper::title(JText::_('COM_REDSHOP_ACCESS_MANAGER'));
+ JToolBarHelper::apply('access.save');
+ }
}
diff --git a/component/admin/views/accountgroup/index.html b/component/admin/views/accountgroup/index.html
index fa6d84e8055..1cbdf58d903 100644
--- a/component/admin/views/accountgroup/index.html
+++ b/component/admin/views/accountgroup/index.html
@@ -1 +1,3 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/component/admin/views/accountgroup/tmpl/default.php b/component/admin/views/accountgroup/tmpl/default.php
index 097b27e3f13..541741932e1 100644
--- a/component/admin/views/accountgroup/tmpl/default.php
+++ b/component/admin/views/accountgroup/tmpl/default.php
@@ -1,4 +1,5 @@
diff --git a/component/admin/views/accountgroup/tmpl/index.html b/component/admin/views/accountgroup/tmpl/index.html
index fa6d84e8055..1cbdf58d903 100644
--- a/component/admin/views/accountgroup/tmpl/index.html
+++ b/component/admin/views/accountgroup/tmpl/index.html
@@ -1 +1,3 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/component/admin/views/accountgroup/view.html.php b/component/admin/views/accountgroup/view.html.php
index cae5c3dcaf2..4bbf5cb71c8 100644
--- a/component/admin/views/accountgroup/view.html.php
+++ b/component/admin/views/accountgroup/view.html.php
@@ -13,37 +13,41 @@
class RedshopViewAccountgroup extends RedshopViewAdmin
{
- public function display($tpl = null)
- {
- global $context;
-
- $app = JFactory::getApplication();
-
- $document = JFactory::getDocument();
- $document->setTitle(JText::_('COM_REDSHOP_ECONOMIC_ACCOUNT_GROUP'));
-
- JToolBarHelper::title(JText::_('COM_REDSHOP_ECONOMIC_ACCOUNT_GROUP'), 'redshop_accountgroup48');
- JToolbarHelper::addNew();
- JToolbarHelper::EditList();
- JToolbarHelper::deleteList();
- JToolBarHelper::publishList();
- JToolBarHelper::unpublishList();
-
- $uri = JFactory::getURI();
-
- $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'accountgroup_id');
- $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
- $lists['order'] = $filter_order;
- $lists['order_Dir'] = $filter_order_Dir;
-
- $detail = $this->get('Data');
- $pagination = $this->get('Pagination');
-
- $this->pagination = $pagination;
- $this->detail = $detail;
- $this->lists = $lists;
- $this->request_url = $uri->toString();
-
- parent::display($tpl);
- }
+ public function display($tpl = null)
+ {
+ global $context;
+
+ $app = JFactory::getApplication();
+
+ $document = JFactory::getDocument();
+ $document->setTitle(JText::_('COM_REDSHOP_ECONOMIC_ACCOUNT_GROUP'));
+
+ JToolBarHelper::title(JText::_('COM_REDSHOP_ECONOMIC_ACCOUNT_GROUP'), 'redshop_accountgroup48');
+ JToolbarHelper::addNew();
+ JToolbarHelper::EditList();
+ JToolbarHelper::deleteList();
+ JToolBarHelper::publishList();
+ JToolBarHelper::unpublishList();
+
+ $uri = JFactory::getURI();
+
+ $filter_order = $app->getUserStateFromRequest(
+ $context . 'filter_order',
+ 'filter_order',
+ 'accountgroup_id'
+ );
+ $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
+ $lists['order'] = $filter_order;
+ $lists['order_Dir'] = $filter_order_Dir;
+
+ $detail = $this->get('Data');
+ $pagination = $this->get('Pagination');
+
+ $this->pagination = $pagination;
+ $this->detail = $detail;
+ $this->lists = $lists;
+ $this->request_url = $uri->toString();
+
+ parent::display($tpl);
+ }
}
diff --git a/component/admin/views/accountgroup_detail/index.html b/component/admin/views/accountgroup_detail/index.html
index fa6d84e8055..1cbdf58d903 100644
--- a/component/admin/views/accountgroup_detail/index.html
+++ b/component/admin/views/accountgroup_detail/index.html
@@ -1 +1,3 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/component/admin/views/accountgroup_detail/tmpl/default.php b/component/admin/views/accountgroup_detail/tmpl/default.php
index dea94115943..ac63a3b05a2 100644
--- a/component/admin/views/accountgroup_detail/tmpl/default.php
+++ b/component/admin/views/accountgroup_detail/tmpl/default.php
@@ -1,4 +1,5 @@
+defined('_JEXEC') or die; ?>
diff --git a/component/admin/views/accountgroup_detail/tmpl/index.html b/component/admin/views/accountgroup_detail/tmpl/index.html
index fa6d84e8055..1cbdf58d903 100644
--- a/component/admin/views/accountgroup_detail/tmpl/index.html
+++ b/component/admin/views/accountgroup_detail/tmpl/index.html
@@ -1 +1,3 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/component/admin/views/accountgroup_detail/view.html.php b/component/admin/views/accountgroup_detail/view.html.php
index c34cce2c55c..dc6eb75c8d7 100644
--- a/component/admin/views/accountgroup_detail/view.html.php
+++ b/component/admin/views/accountgroup_detail/view.html.php
@@ -20,7 +20,8 @@ class RedshopViewAccountgroup_detail extends RedshopViewAdmin
protected $displaySidebar = false;
/**
- * @param null $tpl
+ * @param null $tpl
+ *
* @return mixed|void
*/
public function display($tpl = null)
@@ -30,9 +31,9 @@ public function display($tpl = null)
JToolBarHelper::save();
JToolBarHelper::apply();
- $lists = array();
+ $lists = array();
$detail = $this->get('data');
- $isNew = ($detail->accountgroup_id < 1);
+ $isNew = ($detail->accountgroup_id < 1);
$text = $isNew ? JText::_('COM_REDSHOP_NEW') : JText::_('COM_REDSHOP_EDIT');
@@ -42,12 +43,15 @@ public function display($tpl = null)
\JToolBarHelper::cancel('cancel', JText::_('JTOOLBAR_CLOSE'));
}
- \JToolBarHelper::title(JText::_('COM_REDSHOP_ECONOMIC_ACCOUNT_GROUP') . ':
[ ' . $text . ' ] ', 'redshop_accountgroup48');
+ \JToolBarHelper::title(
+ JText::_('COM_REDSHOP_ECONOMIC_ACCOUNT_GROUP') . ':
[ ' . $text . ' ] ',
+ 'redshop_accountgroup48'
+ );
$lists['published'] = \JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $detail->published);
- $this->detail = $detail;
- $this->lists = $lists;
+ $this->detail = $detail;
+ $this->lists = $lists;
$this->requestUrl = $uri->toString();
parent::display($tpl);
diff --git a/component/admin/views/addorder_detail/index.html b/component/admin/views/addorder_detail/index.html
index fa6d84e8055..1cbdf58d903 100644
--- a/component/admin/views/addorder_detail/index.html
+++ b/component/admin/views/addorder_detail/index.html
@@ -1 +1,3 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/component/admin/views/addorder_detail/tmpl/default.php b/component/admin/views/addorder_detail/tmpl/default.php
index 139ad20cbeb..09bec6ac72c 100644
--- a/component/admin/views/addorder_detail/tmpl/default.php
+++ b/component/admin/views/addorder_detail/tmpl/default.php
@@ -1,4 +1,5 @@
getModel('addorder_detail');
-$billing = $this->billing;
-$shipping = $this->shipping;
+$billing = $this->billing;
+$shipping = $this->shipping;
$isCompany = $billing->is_company;
-if (!empty ($_SERVER['REMOTE_ADDR']))
-{
- $ip = $_SERVER['REMOTE_ADDR'];
-}
-else
-{
- $ip = 'unknown';
+if (!empty ($_SERVER['REMOTE_ADDR'])) {
+ $ip = $_SERVER['REMOTE_ADDR'];
+} else {
+ $ip = 'unknown';
}
$session = JFactory::getSession();
$session->set('ordertotal', 0);
$billisshipcheck = ($this->shipping->billisship) ? "checked" : "";
-$shippingblock = ($this->shipping->billisship) ? "none" : "";
-
-if ($this->detail->user_id < 0)
-{
- $style = "none";
- $create_account = 0;
-}
-else
-{
- $style = "block";
- $create_account = 1;
+$shippingblock = ($this->shipping->billisship) ? "none" : "";
+
+if ($this->detail->user_id < 0) {
+ $style = "none";
+ $create_account = 0;
+} else {
+ $style = "block";
+ $create_account = 1;
}
$allowCustomer = '';
-$allowCompany = '';
-if ($isCompany == 1)
-{
- $allowCustomer = 'style="display:none;"';
-}
-else
-{
- $allowCompany = 'style="display:none;"';
+$allowCompany = '';
+if ($isCompany == 1) {
+ $allowCustomer = 'style="display:none;"';
+} else {
+ $allowCompany = 'style="display:none;"';
}
$err = JFactory::getApplication()->input->get('err', '');
@@ -62,782 +54,877 @@
$app->setUserState('com_redshop.addorder_detail.guestuser.username', null);
?>
input->getCmd('ajaxtask', '')): ?>
-