Skip to content

Commit

Permalink
Merge Release 1.3.5 into master (#68)
Browse files Browse the repository at this point in the history
* Bug #150370 fix : CSRF on delete vendor

* Bug#150110 fix: [Vendor-profile logo- frontend/backend]- Shows alert when user use payload for image (#56)

* Bug#155239 fix: Admin = Vednor -> Add fees = Spelling mistake in error message for exceeding percentage.
https://tracker.tekdi.net/issues/150380
* Bug#155364 fix: Vendors -> PayOuts = Need required sign for mandatory fields.

* Issue #155234 fixed: Backend Vendor Add fees need valid tooltip for currency field also check tooltip for %commission and flat commission (#66)

* Bug #155234 fixed: Backend Vendor Add fees need valid tooltip for currency field also check tooltip for %commission and flat commission

* Bug #155234 fixed: Backend Vendor Add fees Currency field is not required. Also need to have tooltip for valid input.

* Issue #155234 fixed: Backend Vendor Add fees need valid tooltip for currency field also check tooltip for %commission and flat commission

* Issue #155234 fixed: Backend Vendor Add fees need valid tooltip for currency field also check tooltip for %commission and flat commission

* Issue #155234 fixed: Backend Vendor Add fees need valid tooltip for currency field also check tooltip for %commission and flat commission

* Issue #155234 fixed: Backend Vendor Add fees need valid tooltip for currency field also check tooltip for %commission and flat commission

* Issue #155234 fixed: Backend Vendor Add fees need valid tooltip for currency field also check tooltip for %commission and flat commission

* Issue #155234 fixed: Backend Vendor Add fees need valid tooltip for currency field also check tooltip for %commission and flat commission

* Task #150350 chore: Version and date changes (#67)

Co-authored-by: mayank_k <[email protected]>
Co-authored-by: aishwaryab2 <[email protected]>
Co-authored-by: deepa-g <[email protected]>
  • Loading branch information
4 people authored Jan 20, 2020
2 parents 00f4098 + 806c327 commit 528821f
Show file tree
Hide file tree
Showing 11 changed files with 142 additions and 46 deletions.
5 changes: 5 additions & 0 deletions src/com_tjvendors/admin/controllers/vendors.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// No direct access.
defined('_JEXEC') or die;

use Joomla\CMS\Session\Session;

jimport('joomla.application.component.controlleradmin');

/**
Expand Down Expand Up @@ -45,6 +47,9 @@ public function getModel($name = 'vendor', $prefix = 'TjvendorsModel', $config =
*/
public function delete()
{
// Check for request forgeries
Session::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

$input = JFactory::getApplication()->input;
$client = $input->get('client', '', 'STRING');
$cid = JFactory::getApplication()->input->get('cid', array(), 'array');
Expand Down
43 changes: 32 additions & 11 deletions src/com_tjvendors/admin/helpers/tjvendors.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

// No direct access
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;

/**
* Tjvendors helper.
Expand Down Expand Up @@ -278,18 +280,20 @@ public static function getClients($vendor_id)
/**
* Get get unique Currency
*
* @param string $currency integer
* @param string $currency integer
*
* @param string $vendor_id integer
* @param string $vendor_id integer
*
* @param string $client integer
*
* @param string $client integer
* @param integer $id tjvendors_fee
*
* @return boolean
*/

public static function checkUniqueCurrency($currency, $vendor_id, $client)
public static function checkUniqueCurrency($currency, $vendor_id, $client, $id)
{
$db = JFactory::getDbo();
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName('currency'));
$query->from($db->quoteName('#__tjvendors_fee'));
Expand All @@ -304,6 +308,12 @@ public static function checkUniqueCurrency($currency, $vendor_id, $client)
$query->where($db->quoteName('client') . ' = ' . $db->quote($client));
}

// If site admin wants to edit the commission
if ($id)
{
$query->where($db->quoteName('id') . ' = ' . (int) $id);
}

$db->setQuery($query);

try
Expand All @@ -312,19 +322,30 @@ public static function checkUniqueCurrency($currency, $vendor_id, $client)
}
catch (Exception $e)
{
JFactory::getApplication()->enqueueMessage(JText::_('COM_TJVENDORS_DB_EXCEPTION_WARNING_MESSAGE'), 'error');
Factory::getApplication()->enqueueMessage(Text::_('COM_TJVENDORS_DB_EXCEPTION_WARNING_MESSAGE'), 'error');
}

foreach ($currencies as $i)
if (!empty($currencies))
{
if ($currency == $i['currency'])
// If site admin want to edit the commission with same id, currency, client and same vendor id
if ($id && count($currencies) == 1)
{
return false;
break;
return true;
}
else
{
continue;
foreach ($currencies as $i)
{
if ($currency == $i['currency'])
{
return false;
break;
}
else
{
continue;
}
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/com_tjvendors/admin/models/forms/payout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<option value="1">COM_TJVENDORS_PAYOUTS_FORM_PAYOUT_CONFIRMED</option>
<option value="0">COM_TJVENDORS_PAYOUTS_FORM_PAYOUT_PENDING</option>
</field>
<field name="reference_order_id" type="text" label="COM_TJVENDORS_PAYOUTS_FORM_LBL_PAYOUT_REFERENCE_ORDER_ID" class="required" />
<field name="total" type="text" label="COM_TJVENDORS_PAYOUTS_FORM_LBL_PAYOUT_TOTAL" description="COM_TJVENDORS_PAYOUTS_FORM_DESC_PAYOUT_TOTAL" min="0" class="required" />
<field name="reference_order_id" required="true" type="text" label="COM_TJVENDORS_PAYOUTS_FORM_LBL_PAYOUT_REFERENCE_ORDER_ID" class="required" />
<field name="total" required="true" type="text" label="COM_TJVENDORS_PAYOUTS_FORM_LBL_PAYOUT_TOTAL" description="COM_TJVENDORS_PAYOUTS_FORM_DESC_PAYOUT_TOTAL" min="0" class="required" />
<field name="bulk_total" type="number" label="COM_TJVENDORS_PAYOUTS_FORM_LBL_PAYOUT_TOTAL" description="COM_TJVENDORS_PAYOUTS_FORM_DESC_PAYOUT_TOTAL" min="0" class="readonly required" readonly="true" />
</fieldset>
</form>
63 changes: 56 additions & 7 deletions src/com_tjvendors/admin/models/forms/vendorfee.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset addfieldpath="/administrator/components/com_tjvendors/models/fields">
<field name="id" type="int" label="COM_TJVENDORS_FORM_LBL_VENDOR_ID" readonly="true" class="readonly required" description="JGLOBAL_FIELD_ID_DESC" />
<field name="vendor_title" type="text" label="COM_TJVENDORS_FORM_LBL_VENDOR_TITLE" description="COM_TJVENDORS_FORM_DESC_VENDOR_TITLE" hint="COM_TJVENDORS_FORM_LBL_VENDOR_TITLE" filter="" readonly="true" class="readonly required" />
<field name="client" type="text" label="COM_TJVENDORS_FORM_LBL_VENDOR_CLIENT" description="COM_TJVENDORS_FORM_DESC_VENDOR_CLIENT" hint="COM_TJVENDORS_FORM_LBL_VENDOR_CLIENT" filter="" />
<field name="currency" type="text" label="COM_TJVENDORS_FORM_LBL_VENDOR_CURRENCY" description="COM_TJVENDORS_FORM_DESC_VENDOR_CURRENCY" hint="COM_TJVENDORS_FORM_LBL_VENDOR_CURRENCY" filter="" />
<field name="currency_unchange" type="text" label="COM_TJVENDORS_FORM_LBL_VENDOR_CURRENCY" description="COM_TJVENDORS_FORM_DESC_VENDOR_CURRENCY" hint="COM_TJVENDORS_FORM_LBL_VENDOR_CURRENCY" filter="" readonly="true" class="readonly required" />
<field name="percent_commission" type="number" size="40" class="inputbox validate-numeric" label="COM_TJVENDORS_VENDORS_PERCENT_COMMISSION" description="COM_TJVENDORS_FORM_DESC_VENDOR_PERCENT_COMMISSION" hint="COM_TJVENDORS_VENDORS_PERCENT_COMMISSION" min="0" max="100" filter="" />
<field name="flat_commission" type="number" min="0" size="40" default="0" class="inputbox validate-numeric" label="COM_TJVENDORS_FORM_LBL_VENDOR_FLAT_COMMISSION" description="COM_TJVENDORS_FORM_DESC_VENDOR_FLAT_COMMISSION" hint="COM_TJVENDORS_FORM_LBL_VENDOR_FLAT_COMMISSION" filter="" />
<field
name="id"
type="int"
label="COM_TJVENDORS_FORM_LBL_VENDOR_ID"
readonly="true"
class="readonly required"
description="JGLOBAL_FIELD_ID_DESC" />

<field
name="vendor_title"
type="text"
label="COM_TJVENDORS_FORM_LBL_VENDOR_TITLE"
description="COM_TJVENDORS_FORM_DESC_VENDOR_TITLE"
hint="COM_TJVENDORS_FORM_LBL_VENDOR_TITLE"
filter=""
readonly="true"
class="readonly required" />

<field
name="client"
type="text"
label="COM_TJVENDORS_FORM_LBL_VENDOR_CLIENT"
description="COM_TJVENDORS_FORM_DESC_VENDOR_CLIENT"
hint="COM_TJVENDORS_FORM_LBL_VENDOR_CLIENT"
filter="" />

<field
name="currency"
type="text"
label="COM_TJVENDORS_FORM_LBL_VENDOR_CURRENCY"
description="COM_TJVENDORS_FORM_DESC_VENDOR_CURRENCY"
required="true"
hint="COM_TJVENDORS_FORM_LBL_VENDOR_CURRENCY"
filter="" />

<field
name="percent_commission"
type="number"
size="40"
class="inputbox validate-numeric"
label="COM_TJVENDORS_VENDORS_PERCENT_COMMISSION"
description="COM_TJVENDORS_FORM_DESC_VENDOR_PERCENT_COMMISSION"
hint="COM_TJVENDORS_VENDORS_PERCENT_COMMISSION"
min="0" max="100"
filter="" />

<field
name="flat_commission"
type="number"
min="0"
size="40"
default="0"
class="inputbox validate-numeric"
label="COM_TJVENDORS_FORM_LBL_VENDOR_FLAT_COMMISSION"
description="COM_TJVENDORS_FORM_DESC_VENDOR_FLAT_COMMISSION"
hint="COM_TJVENDORS_FORM_LBL_VENDOR_FLAT_COMMISSION" filter="" />
</fieldset>
</form>
31 changes: 22 additions & 9 deletions src/com_tjvendors/admin/models/vendorfee.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

// No direct access.
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;

jimport('joomla.application.component.modeladmin');

Expand Down Expand Up @@ -122,7 +124,6 @@ protected function loadFormData()
$this->item = $this->getItem();
}

$this->item->currency_unchange = $this->item->currency;
$data = $this->item;
}

Expand All @@ -134,20 +135,32 @@ protected function loadFormData()
*
* @param Array $data Data
*
* @return id
* @return boolean true or false
*/
public function save($data)
{
$isNew = (empty($data['id']))? true : false;
$app = JFactory::getApplication();
$table = $this->getTable();
$db = JFactory::getDbo();
$app = Factory::getApplication();
$isNew = (empty($data['id']))? true : false;

if ($isNew && empty($data['currency']))
{
$this->setError(Text::_('COM_TJVENDORS_VENDORFEE_INVALID_CURRENCY'));

return false;
}

$input = $app->input;
$data['vendor_id'] = $input->get('vendor_id', '', 'INTEGER');
$uniqueCurrency = TjvendorsHelper::checkUniqueCurrency($data['currency'], $data['vendor_id'], $data['client']);
$uniqueCurrency = TjvendorsHelper::checkUniqueCurrency($data['currency'], $data['vendor_id'], $data['client'], $data['id']);

if (!empty($uniqueCurrency))
if ($uniqueCurrency)
{
// While editing the fees don't allow to edit currency
if ($data['id'])
{
unset($data['currency']);
}

if (parent::save($data))
{
if (empty($data['id']))
Expand All @@ -164,7 +177,7 @@ public function save($data)
}
else
{
$app->enqueueMessage(JText::_('COM_TJVENDORS_VENDORFEE_DUPLICATE_CURRENCY'), 'error');
$this->setError(Text::_('COM_TJVENDORS_VENDORFEE_DUPLICATE_CURRENCY'));
}

return false;
Expand Down
4 changes: 4 additions & 0 deletions src/com_tjvendors/admin/tables/vendor.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ public function check()
}

$filename = JFile::stripExt($singleFile['name']);

// Strip unwanted characters
$filename = JFile::makeSafe($filename);

$extension = JFile::getExt($singleFile['name']);
$fileType = $singleFile['type'];
$filename = md5(time()) . $filename;
Expand Down
7 changes: 4 additions & 3 deletions src/com_tjvendors/admin/views/vendorfee/tmpl/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@
<fieldset class="adminform">

<?php
echo $this->form->renderField('vendor_title');

if($this->item->vendor_id == 0)
{
echo $this->form->renderField('vendor_title');
echo $this->form->renderField('currency');
}
else
{
echo $this->form->renderField('vendor_title');
echo $this->form->renderField('currency_unchange');
$this->form->setFieldAttribute('currency', 'readonly', 'true');
echo $this->form->renderField('currency');
?>
<input type="hidden" name="jform[vendor_id]" value="<?php echo $this->vendor_id; ?>" />
<?php
Expand Down
13 changes: 8 additions & 5 deletions src/com_tjvendors/admin_language/en-GB/en-GB.com_tjvendors.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ COM_TJVENDORS_TO_FILTER="To %s"
COM_TJVENDORS_VIEW_FILE="[View File]"
COM_TJVENDORS_ITEMS_SUCCESS_DUPLICATED="Items successfully duplicated"
COM_TJVENDORS_TITLE_VENDORS_FEES="Fees List"
COM_TJVENDORS_FEES_PERCENT_ERROR="Invalid Percent Commission: Percent commision should be less than 100"
COM_TJVENDORS_FEES_PERCENT_ERROR="Invalid Percent Commission: Percent commission should be less than 100"
COM_TJVENDORS_FEES_PERCENT_ERROR_DESC="Please enter % commission less than 100"
COM_TJVENDORS_FORM_LBL_VENDOR_VENDOR_FEE_TITLE="Vendor Title"
COM_TJVENDORS_TITLE_REPORTS="Reports"
Expand Down Expand Up @@ -76,19 +76,19 @@ COM_TJVENDORS_FORM_DESC_VENDOR_VENDOR_ID="Select Vendor Name"
COM_TJVENDORS_FORM_LBL_VENDOR_VENDOR_TITLE="Vendor "
COM_TJVENDORS_FORM_DESC_VENDOR_VENDOR_TITLE="Vendor Title"
COM_TJVENDORS_FORM_LBL_VENDOR_CURRENCY="Currency"
COM_TJVENDORS_FORM_DESC_VENDOR_CURRENCY="Currency"
COM_TJVENDORS_FORM_DESC_VENDOR_CURRENCY="Enter the currency code here (for e.g. if you are using the US currency enter USD)"
COM_TJVENDORS_FORM_DESC_VENDOR_FEE_CURRECNY="Currency"
COM_TJVENDORS_FORM_LBL_VENDOR_CLIENT="Client"
COM_TJVENDORS_FORM_DESC_VENDOR_CLIENT="Enter Client (eg.if jticketing is client then enter com_jticketing)"
COM_TJVENDORS_FORM_LBL_VENDOR_TITLE="Title"
COM_TJVENDORS_FORM_LBL_VENDOR_TITLE="Vendor Title"
COM_TJVENDORS_FORM_DESC_VENDOR_TITLE="Enter the vendor title"
COM_TJVENDORS_FORM_LBL_VENDOR_PROFILE_DESCRIPTION="Description"
COM_TJVENDORS_FORM_DESC_VENDOR_PROFILE_DESCRIPTION="Enter short description about vendor."
COM_TJVENDORS_FORM_LBL_VENDOR_PROFILE_AVATAR="Logo"
COM_TJVENDORS_FORM_DESC_VENDOR_PROFILE_AVATAR="Select image for vendor profile."
COM_TJVENDORS_FORM_LBL_VENDOR_FLAT_COMMISSION="Flat Commission"
COM_TJVENDORS_FORM_DESC_VENDOR_FLAT_COMMISSION="Set fixed commission fee to be charged per transaction for specific user. For example, if Admin set $5 commission for user1 here and if $10 commission is set in components (JTickting) configuration field - in this case $5 commission will be applied per transaction for user1."
COM_TJVENDORS_FORM_DESC_VENDOR_PERCENT_COMMISSION="Set Percent commission fee to be charged per transaction for specific user. For example, if Admin set 50% commission for user1 here and if $10 commission is set in components (JTickting) configuration field - in this case $5 commission will be applied per transaction for user1."
COM_TJVENDORS_FORM_DESC_VENDOR_FLAT_COMMISSION="Set flat commission fee to be charged per transaction for specific user. For example, if Admin set $5 flat commission for user1 here and if $10 fixed commission is set in components (JTickting) configuration field - in this case $5 flat commission will be applied per transaction for user1."
COM_TJVENDORS_FORM_DESC_VENDOR_PERCENT_COMMISSION="Set Percent commission fee to be charged per transaction for the specific user. For example, if Admin sets 50 percent commission for user1 here, and if 10 percent commission in components (JTickting) configuration field - in this case, 50 percent commission will be applied per transaction for user1."
COM_TJVENDORS_SELECT_USERNAME="Please select User Name."
COM_TJVENDORS_CONFIRM_TO_DELETE_RECORD="Are you sure you want to delete this record?"
COM_TJVENDORS_SUCCESSFULLY="Record inserted successfully."
Expand Down Expand Up @@ -242,3 +242,6 @@ COM_TJVENDORS_VENDOR_SELECT_VENDOR="Select Vendor"
; Since v1.3.3
COM_TJVENDORS_LOAD_BOOTSTRAP="Load bootstrap"
COM_TJVENDORS_LOAD_BOOTSTRAP_DESC="If your site template is standard bootstrap template & Joomla version is 3.0 or greater then no need to load bootstrap"

; Since v1.3.5
COM_TJVENDORS_VENDORFEE_INVALID_CURRENCY="Please enter Currency"
6 changes: 3 additions & 3 deletions src/com_tjvendors/tjvendors.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.0" method="upgrade">
<name>COM_TJVENDORS</name>
<creationDate>22nd Oct 2019</creationDate>
<copyright>Copyright (C) 2016 - 2019 Techjoomla. All rights reserved.</copyright>
<creationDate>20th Jan 2020</creationDate>
<copyright>Copyright (C) 2016 - 2020 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<author>Techjoomla</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
<version>1.3.4</version>
<version>1.3.5</version>
<description>COM_TJVENDORS_PRODUCT_DESC</description>
<install>
<!-- Runs on install -->
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/actionlog/tjvendors/tjvendors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension version="3.9" type="plugin" group="actionlog" method="upgrade">
<name>plg_actionlog_tjvendors</name>
<author>Techjoomla</author>
<creationDate>22nd Oct 2019</creationDate>
<copyright>Copyright (C) 2016 - 2019 Techjoomla. All rights reserved.</copyright>
<creationDate>20th Jan 2020</creationDate>
<copyright>Copyright (C) 2016 - 2020 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
<version>1.3.4</version>
<version>1.3.5</version>
<description>PLG_ACTIONLOG_TJVENDORS_XML_DESCRIPTION</description>
<files>
<filename plugin="tjvendors">tjvendors.php</filename>
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/privacy/tjvendors/tjvendors.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.9" type="plugin" group="privacy" method="upgrade">
<name>plg_privacy_tjvendors</name>
<version>1.3.4</version>
<creationDate>22nd Oct 2019</creationDate>
<version>1.3.5</version>
<creationDate>20th Jan 2020</creationDate>
<author>Techjoomla</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
<copyright>Copyright (C) 2016 - 2019 Techjoomla. All rights reserved.</copyright>
<copyright>Copyright (C) 2016 - 2020 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<description>PLG_PRIVACY_TJVENDORS_XML_DESCRIPTION</description>
<files>
Expand Down

0 comments on commit 528821f

Please sign in to comment.