Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Vendor class implementation #61

Open
wants to merge 6 commits into
base: release-1.5.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/com_tjvendors/admin/models/vendor.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

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

jimport('joomla.application.component.modeladmin');
/**
* Tjvendors model.
*
* @since 1.6
* @since 1.0.0
*/
JLoader::import('com_tjvendors.models.vendor', JPATH_SITE . '/components');
8 changes: 5 additions & 3 deletions src/com_tjvendors/admin/tables/vendorclientxref.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

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

use Joomla\CMS\Table\Table;

/**
* vendor Table class
*
* @since 1.6
* @since 1.0.0
*/
class TjvendorsTablevendorclientxref extends JTable
class TjvendorsTablevendorclientxref extends Table
{
/**
* Constructor
Expand All @@ -27,6 +28,7 @@ public function __construct(&$db)
{
$tableName = 'TjvendorsTablevendorclientxref';
JObserverMapper::addObserverClassToClass('JTableObserverContenthistory', $tableName, array('typeAlias' => 'com_tjvendors.vendorclientxref'));

parent::__construct('#__vendor_client_xref', 'vendor_id', $db);
}
}
2 changes: 2 additions & 0 deletions src/com_tjvendors/admin/tjvendors.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'));
}

include_once JPATH_SITE . '/components/com_tjvendors/includes/tjvendors.php';

// Include dependancies
jimport('joomla.application.component.controller');

Expand Down
16 changes: 8 additions & 8 deletions src/com_tjvendors/admin/views/vendor/tmpl/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
<div class="span10 form-horizontal">
<fieldset class="adminform">
<input type="hidden" name="jform[vendor_id]" value="<?php echo $this->item->vendor_id; ?>" />
<input type="hidden" name="jform[checked_out_time]" value="<?php echo $this->item->checked_out_time; ?>" />
<input type="hidden" name="jform[checked_out]" value="<?php echo $this->item->checked_out; ?>" />
<input type="hidden" name="jform[state]" value="<?php echo $this->item->state; ?>" />
<input type="hidden" name="jform[ordering]" value="<?php echo $this->item->ordering; ?>" />
<input type="hidden" name="jform[checked_out_time]" value="<?php echo $this->form->getValue('checked_out_time'); ?>" />
<input type="hidden" name="jform[checked_out]" value="<?php echo $this->form->getValue('checked_out'); ?>" />
<input type="hidden" name="jform[state]" value="<?php echo $this->form->getValue('state'); ?>" />
<input type="hidden" name="jform[ordering]" value="<?php echo $this->form->getValue('ordering'); ?>" />
<input type="hidden" name="jform[vendor_client]" value="<?php echo $this->input->get('client', '', 'STRING'); ?>" />

<?php
Expand All @@ -52,15 +52,15 @@
$input=JFactory::getApplication()->input;
$client=$input->get('client', '', 'STRING');
?>
<input type="hidden" name="jform[vendor_title]" id="jform_vendor_titile_hidden" value="<?php echo $this->item->vendor_title; ?>" />
<input type="hidden" name="jform[vendor_description]" id="jform_vendor_description_hidden" value="<?php echo $this->item->vendor_description; ?>" />
<input type="hidden" name="jform[vendor_logo]" id="jform_vendor_logo_hidden" value="<?php echo $this->item->vendor_logo; ?>" />
<input type="hidden" name="jform[vendor_title]" id="jform_vendor_titile_hidden" value="<?php echo $this->item->getTitle();; ?>" />
<input type="hidden" name="jform[vendor_description]" id="jform_vendor_description_hidden" value="<?php echo $this->form->getValue('vendor_description'); ?>" />
<input type="hidden" name="jform[vendor_logo]" id="jform_vendor_logo_hidden" value="<?php echo $this->item->getLogo(); ?>" />
<?php echo $this->form->renderField('user_id');?>
<div class="pull-left alert alert-info">
<?php echo JText::_('COM_TJVENDORS_DISPLAY_YOU_ARE_ALREADY_A_VENDOR_AS');?>
<a href="<?php echo JRoute::_(JURI::root() . '/administrator/index.php?option=com_tjvendors&view=vendor&layout=update&client=' . $client . '&vendor_id='.$this->item->vendor_id);?>"><strong>
<?php
echo $this->item->vendor_title."</a></strong>";
echo $this->item->getTitle() . "</a></strong>";
echo " ".JText::_('COM_TJVENDORS_DISPLAY_DO_YOU_WANT_TO_ADD');
$tjvendorFrontHelper = new TjvendorFrontHelper();
echo $clientTitle = $tjvendorFrontHelper->getClientName($client);
Expand Down
12 changes: 6 additions & 6 deletions src/com_tjvendors/admin/views/vendor/tmpl/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@

<form action="<?php echo JRoute::_('index.php?option=com_tjvendors&layout=edit&client='.$this->input->get('client', '', 'INTEGER').'&vendor_id=' . (int) $this->item->vendor_id); ?>"
method="post" enctype="multipart/form-data" name="adminForm" id="adminForm" class="form-validate">
<input type="hidden" name="jform[state]" value="<?php echo $this->item->state; ?>" />
<input type="hidden" name="jform[state]" value="<?php echo $this->item->get('state'); ?>" />
<div class="form-horizontal">
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'personal')); ?>
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'personal', JText::_('COM_TJVENDORS_TITLE_PERSONAL', true)); ?>
<div class="row-fluid">
<div class="span10 form-horizontal">
<fieldset class="adminform">
<input type="hidden" name="jform[vendor_id]" value="<?php echo $this->item->vendor_id; ?>" />
<input type="hidden" name="jform[checked_out_time]" value="<?php echo $this->item->checked_out_time; ?>" />
<input type="hidden" name="jform[checked_out]" value="<?php echo $this->item->checked_out; ?>" />
<input type="hidden" name="jform[state]" value="<?php echo $this->item->state; ?>" />
<input type="hidden" name="jform[ordering]" value="<?php echo $this->item->ordering; ?>" />
<input type="hidden" name="jform[checked_out_time]" value="<?php echo $this->form->getValue('checked_out_time'); ?>" />
<input type="hidden" name="jform[checked_out]" value="<?php echo $this->form->getValue('checked_out'); ?>" />
<input type="hidden" name="jform[state]" value="<?php echo $this->form->getValue('state'); ?>" />
<input type="hidden" name="jform[ordering]" value="<?php echo $this->form->getValue('ordering'); ?>" />
<input type="hidden" name="jform[vendor_client]" value="<?php echo $this->input->get('client', '', 'STRING'); ?>" />

<?php
Expand All @@ -62,7 +62,7 @@
?>
</div>

<input type="hidden" name="jform[vendor_logo]" id="jform_vendor_logo_hidden" value="<?php echo $this->item->vendor_logo; ?>" />
<input type="hidden" name="jform[vendor_logo]" id="jform_vendor_logo_hidden" value="<?php echo $this->form->getValue('vendor_logo'); ?>" />
<?php if (!empty($this->item->vendor_logo)) : ?>
<div class="control-group">
<div><img src="<?php echo JUri::root() . $this->item->vendor_logo; ?>" class="span3 col-md-3 img-thumbnail pull-left marginb10 img-polaroid"></div>
Expand Down
28 changes: 14 additions & 14 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 @@ -49,7 +49,7 @@ COM_TJVENDORS_VENDOR_APPROVAL_DESC="Admin needs to approve new vendor created in
; Add vendor view
COM_TJVENDORS_TITLE_PERSONAL="Vendor Information"
COM_TJVENDORS_FORM_DESC_VENDOR_USER_ID="Select user"
COM_TJVENDORS_CURRENCY_RECORDS="Curreny is not present"
COM_TJVENDORS_CURRENCY_RECORDS="Currency is not present"
COM_TJVENDORS_FILE_UPLOAD_ALLOWED_EXTENSIONS="Allowed file extensions are - %s"
COM_TJVENDORS_WRONG_FILE_UPLOAD=" The uploaded file type is not allowed. Allowed file types are jpg, jpeg, png"
COM_TJVENDORS_TITLE_VENDORS="Vendors"
Expand Down Expand Up @@ -95,15 +95,15 @@ COM_TJVENDORS_SUCCESSFULLY="Record inserted successfully."
COM_TJVENDORS_ALREADY_EXISTED="User already existed."
COM_TJVENDORS_RECORD_DELETED="Record deleted successfully"
COM_TJVENDORS_ERR_DELETED="Error Deleting Records"
COM_TJVENDORS_SELECT_USER_RESET_ERROR="Plese Select the Vendor First"
COM_TJVENDORS_SELECT_USER_RESET_SUCCESS="Successfull Currency Reset : "
COM_TJVENDORS_SELECT_USER_RESET_ERROR="Please Select the Vendor First"
COM_TJVENDORS_SELECT_USER_RESET_SUCCESS="Successfully Currency Reset : "
COM_TJVENDORS_FORM_LBL_VENDOR_CLIENTS="Is a vendor for"
COM_TJVENDORS_DUPLICATE_CLIENT_ERROR="Registration for Duplicate Client not possible. Please Select New Client"
COM_TJVENDORS_DISPLAY_YOU_ARE_ALREADY_A_VENDOR_AS="You are already a vendor as"
COM_TJVENDORS_DISPLAY_DO_YOU_WANT_TO_ADD="Do you want to add "
COM_TJVENDORS_DISPLAY_AS_A_CLIENT=" as a client"
COM_TJVENDORS_VENDOR_LOGO_SIZE_VALIDATE="Upload an image within the specified size "
COM_TJVENDORS_VENDOR_LOGO_DIMENSIONS_VALIDATE=" Upload an image having dimentional value greater than "
COM_TJVENDORS_VENDOR_LOGO_DIMENSIONS_VALIDATE=" Upload an image having dimensional value greater than "
COM_TJVENDORS_VENDOR_LOGO_IMAGE_TYPE_VALIDATION="Upload an image in proper format."
COM_TJVENDORS_FORM_LBL_VENDOR_PAYMENT_GATEWAY="Choose Payment Gateway "
COM_TJVENDORS_TITLE_PAYMENT_DETAILS="Payment Gateway Details"
Expand Down Expand Up @@ -175,10 +175,10 @@ COM_TJVENDOR_EDIT_PAYOUT_SPECIFIC_COMM=" :Pay the Remaining Amount"
COM_TJVENDORS_PAYOUTS_ID="ID"
COM_TJVENDORS_VENDOR_APPROVAL="Enable vendor approval?"
COM_TJVENDORS_VENDOR_APPROVAL_DESC="Enabling this configuration will let the administrator approve or deny any vendor that has registered on the site. After the administrator has approved, the vendor will then have the create rights."
COM_TJVENDORS_PAYOUTS_PAID_UPTO="Paid Upto Date"
COM_TJVENDOR_PAYOUTS_BULK_PAYOUT_NOTICE="<strong>Bulk Payout</strong>: Enables you to make payout for a particular vendor against a currency for all the clients associated with that vendor. The pending amount and the paid upto date columns show you the amount against that vendor for all clients he has."
COM_TJVENDOR_PAYOUTS_SINGLE_CLIENT_PAYOUT_NOTICE="<strong>Single Client Payout</strong>: Enables you to make payout for a particular vendor against a currency for a specified client. The paid upto date amount and the pending amount that appears are for one client."
COM_TJVENDORS_PAYOUT_SUCCESSFULL_MESSAGE = "Payout Successsfully Done."
COM_TJVENDORS_PAYOUTS_PAID_UPTO="Paid Up-to Date"
COM_TJVENDOR_PAYOUTS_BULK_PAYOUT_NOTICE="<strong>Bulk Payout</strong>: Enables you to make payout for a particular vendor against a currency for all the clients associated with that vendor. The pending amount and the paid up-to date columns show you the amount against that vendor for all clients he has."
COM_TJVENDOR_PAYOUTS_SINGLE_CLIENT_PAYOUT_NOTICE="<strong>Single Client Payout</strong>: Enables you to make payout for a particular vendor against a currency for a specified client. The paid up-to date amount and the pending amount that appears are for one client."
COM_TJVENDORS_PAYOUT_SUCCESSFULL_MESSAGE = "Payout Successfully Done."
COM_TJVENDORS_PAYOUTS_BULK_LABEL= "Enter Payout Date Limit"
COM_TJVENDORS_PAYOUTS_BULK_DESCRIPTION="Enter the no of days before which the payout will be calculated. Example when there are credit entries throughout this month but you want to calculate the payout amount for the whole month excluding the 5 days before today."
COM_TJVENDORS_IMAGE_SIZE="Maximum Image Size for Vendor's Logo"
Expand Down Expand Up @@ -216,12 +216,12 @@ COM_TJVENDORS_STATUS_CREDIT_DONE="Credit done"
COM_TJVENDORS_BACK="Back"

;Clients
PLG_PAYPAL_PAYMENET_GATEWAY_EMAIL_ID="Paypal Email Id"
PLG_PAYPAL_PAYMENET_GATEWAY_EMAIL_ID_DESCRIPTION="Email id for paypal"
PLG_PAYPAL_PAYMENET_GATEWAY_PARAMETERS="Paypal plugin parameters"
PLG_ADAPTIVE_PAYPAL_PAYMENET_GATEWAY_EMAIL_ID="Adaptive Paypal Email id"
PLG_PAYPAL_PRO_PAYMENET_GATEWAY_EMAIL_ID="Paypal Pro Email id"
PLG_ADAPTIVE_PAYPAL_PAYMENET_GATEWAY_EMAIL_ID_DESCRIPTION="Enter the email id for paypal adaptive."
PLG_PAYPAL_PAYMENET_GATEWAY_EMAIL_ID="PayPal Email Id"
PLG_PAYPAL_PAYMENET_GATEWAY_EMAIL_ID_DESCRIPTION="Email id for PayPal"
PLG_PAYPAL_PAYMENET_GATEWAY_PARAMETERS="PayPal plugin parameters"
PLG_ADAPTIVE_PAYPAL_PAYMENET_GATEWAY_EMAIL_ID="Adaptive PayPal Email id"
PLG_PAYPAL_PRO_PAYMENET_GATEWAY_EMAIL_ID="PayPal Pro Email id"
PLG_ADAPTIVE_PAYPAL_PAYMENET_GATEWAY_EMAIL_ID_DESCRIPTION="Enter the email id for PayPal adaptive."
COM_TJVENDOR_PAYMENT_DETAILS_DEFAULT="Select payment gateway"
; Generic
COM_TJVENDORS_SITEADMIN="Siteadmin"
Expand Down
2 changes: 1 addition & 1 deletion src/com_tjvendors/site/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TjvendorsController extends BaseController
*
* @since 1.0.0
*/
public function display($cachable = false, $urlparams = false)
public function display($cachable = false, $urlparams = array())
{
$view = Factory::getApplication()->input->getCmd('view', 'vendors');
Factory::getApplication()->input->set('view', $view);
Expand Down
13 changes: 6 additions & 7 deletions src/com_tjvendors/site/controllers/vendor.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

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

jimport('joomla.application.component.controllerform');
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/tjvendors.php');
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Controller\FormController;

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

$this->vendor_client = $this->input->get('client', '', 'STRING');

Expand Down
10 changes: 9 additions & 1 deletion src/com_tjvendors/site/helpers/fronthelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class TjvendorFrontHelper
*
* @param string $name Model name
*
* @deprecated __DEPLOY_VERSION__ use the alternative method TJVendors::model
*
* @return null|object
*/
public static function getModel($name)
Expand Down Expand Up @@ -98,7 +100,7 @@ public static function getUniqueClients($user_id)
*
* @param string $currency integer
*
* @return amount
* @return array
*/
public static function getTotalDetails($vendor_id, $client, $currency)
{
Expand Down Expand Up @@ -191,6 +193,8 @@ public static function getClientsForVendor($vendor_id)
/**
* Get vendor for that user
*
* @deprecated __DEPLOY_VERSION__ use the alternative method TJVendors::vendor()->loadByUserId
*
* @return integer
*/
public static function getvendor()
Expand Down Expand Up @@ -294,6 +298,8 @@ public static function getPaymentDetails($vendor_id, $client)
*
* @param string $client client
*
* @deprecated __DEPLOY_VERSION__ use the alternative method from TJVendorsVendor class
*
* @return mixed
*
* @since 1.1
Expand Down Expand Up @@ -634,6 +640,8 @@ public function getPaymentGatewayConfig($vendorId, $client = "", $global = true)
* @param string $client client
* @param integer $vendorId Venodor ID
*
* @deprecated __DEPLOY_VERSION__ use the alternative method TJVendors::vendor()->isAssociatedToClient
*
* @return Boolean Client exist or not
*
* @since 1.3.0
Expand Down
3 changes: 3 additions & 0 deletions src/com_tjvendors/site/includes/tjvendors.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
*
* This class perform the helpful operation required to TJVendors package
*
* @method TjvendorsVersion version()
* @method TjvendorsVendor vendor()
*
* @since __DEPLOY_VERSION__
*/
class TJVendors
Expand Down
Loading