forked from unacms/una
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
1,853 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* Copyright (c) UNA, Inc - https://una.io | ||
* MIT License - https://opensource.org/licenses/MIT | ||
* | ||
* @defgroup UnaCore UNA Core | ||
* @{ | ||
*/ | ||
|
||
require_once('./inc/header.inc.php'); | ||
require_once(BX_DIRECTORY_PATH_INC . "design.inc.php"); | ||
|
||
bx_import('BxDolLanguages'); | ||
|
||
check_logged(); | ||
|
||
$sUrl = BxDolPayments::getInstance()->getInvoicesUrl(); | ||
if(empty($sUrl)) | ||
BxDolTemplate::getInstance()->displayPageNotFound(); | ||
|
||
header('Location: ' . $sUrl); | ||
exit; | ||
|
||
/** @} */ |
81 changes: 81 additions & 0 deletions
81
modules/base/payment/classes/BxBaseModPaymentCommissions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php defined('BX_DOL') or die('hack attempt'); | ||
/** | ||
* Copyright (c) UNA, Inc - https://una.io | ||
* MIT License - https://opensource.org/licenses/MIT | ||
* | ||
* @defgroup BasePayment Base classes for Payment like modules | ||
* @ingroup UnaModules | ||
* | ||
* @{ | ||
*/ | ||
|
||
class BxBaseModPaymentCommissions extends BxDol | ||
{ | ||
protected $_sModule; | ||
protected $_oModule; | ||
|
||
function __construct() | ||
{ | ||
parent::__construct(); | ||
|
||
$this->_oModule = BxDolModule::getInstance($this->_sModule); | ||
} | ||
|
||
/** | ||
* @page service Service Calls | ||
* @section bx_base_payment Base Payment | ||
* @subsection bx_base_payment-integration Integration | ||
* @subsubsection bx_base_payment-get_invoices_url get_invoices_url | ||
* | ||
* @code bx_srv('bx_payment', 'get_invoices_url', [...], 'Commissions'); @endcode | ||
* | ||
* Get invoices page URL. | ||
* | ||
* @return string with invoices page URL. | ||
* | ||
* @see BxBaseModPaymentOrders::serviceGetOrdersUrl | ||
*/ | ||
/** | ||
* @ref bx_base_payment-get_invoices_url "get_invoices_url" | ||
*/ | ||
public function serviceGetInvoicesUrl() | ||
{ | ||
if(!$this->_oModule->isLogged()) | ||
return ''; | ||
|
||
return $this->_oModule->_oConfig->getUrl('URL_INVOICES'); | ||
} | ||
|
||
/** | ||
* @page service Service Calls | ||
* @section bx_base_payment Base Payment | ||
* @subsection bx_base_payment-integration Integration | ||
* @subsubsection bx_base_payment-get_invoices_count get_invoices_count | ||
* | ||
* @code bx_srv('bx_payment', 'get_invoices_count', [...], 'Commissions'); @endcode | ||
* | ||
* Get invoices count by type. | ||
* | ||
* @param $sType string value with type. | ||
* @param $iProfileId (optional) integer value with profile ID. If empty value is provided then currently logged in profile will be used. | ||
* @return integer value with invoices count. | ||
* | ||
* @see BxBaseModPaymentOrders::serviceGetOrdersCount | ||
*/ | ||
/** | ||
* @ref bx_base_payment-get_invoices_count "get_invoices_count" | ||
*/ | ||
public function serviceGetInvoicesCount($sType, $iProfileId = 0) | ||
{ | ||
if(!in_array($sType, array('unpaid', 'overdue'))) | ||
return 0; | ||
|
||
$iProfileId = !empty($iProfileId) ? $iProfileId : $this->_oModule->getProfileId(); | ||
if(empty($iProfileId)) | ||
return 0; | ||
|
||
return $this->_oModule->_oDb->getInvoices(array('type' => 'status', 'status' => $sType, 'committent_id' => $iProfileId, 'count' => true)); | ||
} | ||
} | ||
|
||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
modules/base/payment/classes/BxBaseModPaymentGridCommissions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php defined('BX_DOL') or die('hack attempt'); | ||
/** | ||
* Copyright (c) UNA, Inc - https://una.io | ||
* MIT License - https://opensource.org/licenses/MIT | ||
* | ||
* @defgroup BasePayment Base classes for Payment like modules | ||
* @ingroup UnaModules | ||
* | ||
* @{ | ||
*/ | ||
|
||
class BxBaseModPaymentGridCommissions extends BxTemplGrid | ||
{ | ||
protected $_sModule; | ||
protected $_oModule; | ||
|
||
protected $_sLangsPrefix; | ||
|
||
protected $_aAclLevels; | ||
|
||
public function __construct ($aOptions, $oTemplate = false) | ||
{ | ||
parent::__construct ($aOptions, $oTemplate); | ||
|
||
$this->_oModule = BxDolModule::getInstance($this->_sModule); | ||
|
||
$this->_sLangsPrefix = $this->_oModule->_oConfig->getPrefix('langs'); | ||
|
||
$this->_aAclLevels = BxDolAcl::getInstance()->getMemberships(false, true, true, true); | ||
} | ||
|
||
protected function _getCellAclId($mixedValue, $sKey, $aField, $aRow) | ||
{ | ||
$mixedValue = isset($this->_aAclLevels[$mixedValue]) > 0 ? $this->_aAclLevels[$mixedValue] : _t('_all'); | ||
|
||
return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); | ||
} | ||
|
||
protected function _getCellPercentage($mixedValue, $sKey, $aField, $aRow) | ||
{ | ||
$mixedValue = (float)$mixedValue > 0 ? $mixedValue . '%' : ''; | ||
|
||
return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); | ||
} | ||
|
||
protected function _getCellInstallment($mixedValue, $sKey, $aField, $aRow) | ||
{ | ||
$mixedValue = (float)$mixedValue > 0 ? _t_format_currency($mixedValue) : ''; | ||
|
||
return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow); | ||
} | ||
} | ||
|
||
/** @} */ |
Oops, something went wrong.