Skip to content

Commit

Permalink
Merge pull request #97 from techjoomla/release-1.4.0
Browse files Browse the repository at this point in the history
Merge `Release 1.4.0` in `master`
  • Loading branch information
manojLondhe authored Jun 10, 2020
2 parents 528821f + 93d1b04 commit 3c16793
Show file tree
Hide file tree
Showing 104 changed files with 3,981 additions and 1,548 deletions.
10 changes: 6 additions & 4 deletions src/com_tjvendors/admin/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,30 @@

// No direct access
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\BaseController;

/**
* Class TjvendorsController
*
* @since 1.6
*/
class TjvendorsController extends JControllerLegacy
class TjvendorsController extends BaseController
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param mixed $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
* @param mixed $urlparams An array of safe url parameters and their variable types, for valid values see {@link InputFilter::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
$view = JFactory::getApplication()->input->getCmd('view', 'vendors');
JFactory::getApplication()->input->set('view', $view);
$view = Factory::getApplication()->input->getCmd('view', 'vendors');
Factory::getApplication()->input->set('view', $view);

parent::display($cachable, $urlparams);

Expand Down
12 changes: 6 additions & 6 deletions src/com_tjvendors/admin/controllers/payout.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

// No direct access
defined('_JEXEC') or die;

jimport('joomla.application.component.controllerform');
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\FormController;

/**
* Vendor controller class.
*
* @since 1.6
*/
class TjvendorsControllerPayout extends JControllerForm
class TjvendorsControllerPayout extends FormController
{
/**
* Constructor
Expand All @@ -28,7 +28,7 @@ class TjvendorsControllerPayout extends JControllerForm
public function __construct()
{
$this->view_list = 'payouts';
$this->input = JFactory::getApplication()->input;
$this->input = Factory::getApplication()->input;

if (empty($this->client))
{
Expand All @@ -48,7 +48,7 @@ public function __construct()

protected function getRedirectToListAppend()
{
$input = JFactory::getApplication()->input;
$input = Factory::getApplication()->input;
$vendor_id = $input->get('vendor_id', '', 'INTEGER');
$client = $input->get('client', '', 'STRING');
$append = parent::getRedirectToListAppend();
Expand Down Expand Up @@ -80,7 +80,7 @@ public function addCreditEntry()
*/
public function changePayoutStatus()
{
$input = JFactory::getApplication()->input->post;
$input = Factory::getApplication()->input->post;
$payout_id = $input->get('payout_id', '', 'STRING');
$paidUnpaid = $input->get('paidUnpaid', '', 'STRING');
$model = $this->getModel('Payout');
Expand Down
5 changes: 2 additions & 3 deletions src/com_tjvendors/admin/controllers/payouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@

// No direct access.
defined('_JEXEC') or die;

jimport('joomla.application.component.controlleradmin');
use Joomla\CMS\MVC\Controller\AdminController;

/**
* Vendors list controller class.
*
* @since 1.6
*/
class TjvendorsControllerPayouts extends JControllerAdmin
class TjvendorsControllerPayouts extends AdminController
{
/**
* Proxy for getModel.
Expand Down
5 changes: 2 additions & 3 deletions src/com_tjvendors/admin/controllers/reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@

// No direct access.
defined('_JEXEC') or die;

jimport('joomla.application.component.controlleradmin');
use Joomla\CMS\MVC\Controller\AdminController;

/**
* Vendors list controller class.
*
* @since 1.6
*/
class TjvendorsControllerReports extends JControllerAdmin
class TjvendorsControllerReports extends AdminController
{
/**
* Proxy for getModel.
Expand Down
14 changes: 14 additions & 0 deletions src/com_tjvendors/admin/controllers/vendor.json.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/**
* @package TJVendor
* @subpackage com_tjvendors
*
* @author Techjoomla <[email protected]>
* @copyright Copyright (C) 2009 - 2020 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access to this file
defined('_JEXEC') or die;

include_once JPATH_SITE . '/components/com_tjvendors/controllers/vendor.json.php';
44 changes: 24 additions & 20 deletions src/com_tjvendors/admin/controllers/vendor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@

// No direct access
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\Router\Route;

jimport('joomla.application.component.controllerform');
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/tjvendors.php');
HTMLHelper::addIncludePath(JPATH_COMPONENT . '/helpers/tjvendors.php');

/**
* Vendor controller class.
*
* @since 1.6
*/
class TjvendorsControllerVendor extends JControllerForm
class TjvendorsControllerVendor extends FormController
{
/**
* Constructor
Expand All @@ -45,11 +50,10 @@ public function __construct()
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'vendor_id')
{
$input = JFactory::getApplication()->input;
$input = Factory::getApplication()->input;
$client = $input->get('client', '', 'STRING');
$vendor_id = $input->get('vendor_id', '', 'STRING');
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
$append .= '&client=' . $client . '&vendor_id=' . $vendor_id;
$append .= '&client=' . $client;

return $append;
}
Expand All @@ -63,7 +67,7 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'vendor_i
*/
public function checkDuplicateUser()
{
$input = JFactory::getApplication()->input->post;
$input = Factory::getApplication()->input->post;
$user = $input->get('user', '', 'STRING');
$model = $this->getModel('vendor');
$results = $model->checkDuplicateUser($user);
Expand All @@ -81,7 +85,7 @@ public function checkDuplicateUser()
*/
public function vendorApprove()
{
$input = JFactory::getApplication()->input;
$input = Factory::getApplication()->input;
$vendor_id = $input->post->get('vendor_id', '', 'INTEGER');
$vendorApprove = $input->post->get('vendorApprove', '', 'INTEGER');
$client = $input->get('client', '', 'STRING');
Expand All @@ -91,7 +95,7 @@ public function vendorApprove()
$data['approved'] = $vendorApprove;
$result = $model->save($data);

echo new JResponseJson($result, JText::_('COM_TJVENDORS_VENDOR_APPROVAL_ERROR'), true);
echo new JsonResponse($result, Text::_('COM_TJVENDORS_VENDOR_APPROVAL_ERROR'), true);
}

/**
Expand All @@ -103,7 +107,7 @@ public function vendorApprove()
*/
public function generateGatewayFields()
{
$input = JFactory::getApplication()->input->post;
$input = Factory::getApplication()->input->post;
$payment_gateway = $input->get('payment_gateway', '', 'STRING');
$parentTag = $input->get('parent_tag', '', 'STRING');
$vendor_id = $input->get('vendor_id', '', 'INTEGER');
Expand All @@ -122,7 +126,7 @@ public function generateGatewayFields()
*/
protected function getRedirectToListAppend()
{
$input = JFactory::getApplication()->input->post;
$input = Factory::getApplication()->input->post;
$client = $input->get('client', '', 'STRING');
$append = parent::getRedirectToListAppend();
$append .= '&client=' . $client;
Expand All @@ -144,13 +148,13 @@ protected function getRedirectToListAppend()
public function save($key = null, $urlVar = null)
{
// Initialise variables.
$app = JFactory::getApplication();
$app = Factory::getApplication();
$model = $this->getModel('Vendor', 'TjvendorsModel');
$input = $app->input;
$client = $input->get('client', '', 'STRING');

// Get the user data.
$data = JFactory::getApplication()->input->get('jform', array(), 'array');
$data = Factory::getApplication()->input->get('jform', array(), 'array');

// Validate the posted data.
$form = $model->getForm();
Expand Down Expand Up @@ -187,7 +191,7 @@ public function save($key = null, $urlVar = null)
$id = (int) $app->getUserState('com_tjvendors.edit.vendor.id');
$app->setUserState('com_tjvendors.edit.vendor.data', $data);

$this->setRedirect(JRoute::_('index.php?option=com_tjvendors&view=vendor&layout=edit&client=' . $client . '&vendor_id=' . $id, false));
$this->setRedirect(Route::_('index.php?option=com_tjvendors&view=vendor&layout=edit&client=' . $client . '&vendor_id=' . $id, false));

return false;
}
Expand All @@ -201,13 +205,13 @@ public function save($key = null, $urlVar = null)

// Redirect back to the edit screen.
$id = (int) $app->getUserState('com_tjvendors.edit.vendor.id');
$this->setMessage(JText::sprintf('COM_TJVENDORS_VENDOR_ERROR_MSG_SAVE', $model->getError()), 'warning');
$this->setRedirect(JRoute::_('index.php?option=com_tjvendors&view=vendor&layout=edit&client=' . $client . '&vendor_id=' . $id, false));
$this->setMessage(Text::sprintf('COM_TJVENDORS_VENDOR_ERROR_MSG_SAVE', $model->getError()), 'warning');
$this->setRedirect(Route::_('index.php?option=com_tjvendors&view=vendor&layout=edit&client=' . $client . '&vendor_id=' . $id, false));

return false;
}

$msg = JText::_('COM_TJVENDORS_MSG_SUCCESS_SAVE_VENDOR');
$msg = Text::_('COM_TJVENDORS_MSG_SUCCESS_SAVE_VENDOR');
$id = $input->get('vendor_id');

if (empty($id))
Expand All @@ -219,13 +223,13 @@ public function save($key = null, $urlVar = null)

if ($task == 'apply')
{
$redirect = JRoute::_('index.php?option=com_tjvendors&view=vendor&layout=update&client=' . $client . '&vendor_id=' . $id, false);
$redirect = Route::_('index.php?option=com_tjvendors&view=vendor&layout=edit&client=' . $client . '&vendor_id=' . $id, false);
$app->redirect($redirect, $msg);
}

if ($task == 'save2new')
{
$redirect = JRoute::_('index.php?option=com_tjvendors&view=vendor&layout=edit&client=' . $client, false);
$redirect = Route::_('index.php?option=com_tjvendors&view=vendor&layout=edit&client=' . $client, false);
$app->redirect($redirect, $msg);
}

Expand All @@ -239,7 +243,7 @@ public function save($key = null, $urlVar = null)
}

// Redirect to the list screen.
$redirect = JRoute::_('index.php?option=com_tjvendors&view=vendors&client=' . $client, false);
$redirect = Route::_('index.php?option=com_tjvendors&view=vendors&client=' . $client, false);
$app->redirect($redirect, $msg);

// Flush the data from the session.
Expand Down
26 changes: 14 additions & 12 deletions src/com_tjvendors/admin/controllers/vendorfee.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@

// No direct access
defined('_JEXEC') or die;

jimport('joomla.application.component.controllerform');
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Router\Route;
use Joomla\Registry\Registry;

/**
* Vendor controller class.
*
* @since 1.6
*/
class TjvendorsControllerVendorFee extends JControllerForm
class TjvendorsControllerVendorFee extends FormController
{
/**
* Constructor
Expand All @@ -28,7 +30,7 @@ class TjvendorsControllerVendorFee extends JControllerForm
public function __construct()
{
$this->view_list = 'vendorfees';
$this->input = JFactory::getApplication()->input;
$this->input = Factory::getApplication()->input;

if (empty($this->client))
{
Expand All @@ -50,9 +52,9 @@ public function __construct()
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
$input = JFactory::getApplication()->input;
$input = Factory::getApplication()->input;
$cid = $input->post->get('cid', array(), 'array');
$formData = new JRegistry($input->get('jform', '', 'array'));
$formData = new Registry($input->get('jform', '', 'array'));
$client = $input->get('client', '', 'STRING');
$vendor_id = $input->get('vendor_id', '', 'INTEGER');
$append = parent::getRedirectToItemAppend($recordId);
Expand All @@ -70,9 +72,9 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
*/
protected function getRedirectToListAppend()
{
$input = JFactory::getApplication()->input;
$input = Factory::getApplication()->input;
$cid = $input->post->get('cid', array(), 'array');
$formData = new JRegistry($input->get('jform', '', 'array'));
$formData = new Registry($input->get('jform', '', 'array'));
$client = $input->get('client', '', 'STRING');
$vendor_id = $input->get('vendor_id', '', 'STRING');

Expand All @@ -87,19 +89,19 @@ protected function getRedirectToListAppend()
* Function to edit field data
*
* @param integer $key null.
*
*
* @param integer $urlVar null.
*
*
* @return void
*/
public function edit($key = null, $urlVar = null)
{
$input = JFactory::getApplication()->input;
$input = Factory::getApplication()->input;
$cid = $input->post->get('cid', array(), 'array');
$vendorId = (int) (count($cid) ? $cid[0] : $input->getInt('vendor_id'));
$client = $input->get('client', '', 'STRING');
$feeId = (int) (count($cid) ? $cid[0] : $input->getInt('fee_id'));
$link = JRoute::_(
$link = Route::_(
'index.php?option=com_tjvendors&view=vendorfee&layout=edit&id=' . $feeId . '&vendor_id=' . $vendorId . '&client=' . $client, false
);
$this->setRedirect($link);
Expand Down
11 changes: 6 additions & 5 deletions src/com_tjvendors/admin/controllers/vendorfees.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@

// No direct access.
defined('_JEXEC') or die;

jimport('joomla.application.component.controlleradmin');
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Router\Route;

/**
* Vendors list controller class.
*
* @since 1.6
*/
class TjvendorsControllerVendorFees extends JControllerAdmin
class TjvendorsControllerVendorFees extends AdminController
{
/**
* Proxy for getModel.
Expand Down Expand Up @@ -46,10 +47,10 @@ public function getModel($name = 'vendorfee', $prefix = 'TjvendorsModel', $confi
public function back()
{
// Get the input
$input = JFactory::getApplication()->input;
$input = Factory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');

// Redirect to the list screen.
$this->setRedirect(JRoute::_('index.php?option=com_tjvendors&view=vendors&client=' . $input->get('client', '', 'STRING'), false));
$this->setRedirect(Route::_('index.php?option=com_tjvendors&view=vendors&client=' . $input->get('client', '', 'STRING'), false));
}
}
Loading

0 comments on commit 3c16793

Please sign in to comment.